[SAS] JSON output


/ Published in: SAS
Save to your folder(s)

SAS code to output in JSON format


Copy this code and paste it in your HTML
  1. LIBNAME EDA ORACLE PATH=XE SCHEMA=EDA USER=eda PASSWORD=eda;
  2.  
  3. DATA WAT;
  4. SET EDA.WAT;
  5. KEEP PRODUCT_NAME SPEC_FILE LOT_ID WAFER_ID SITE_ID ATT1 ATT2 ATT3;
  6. WHERE LOT_ID like 'P0M78.1';
  7. RUN;
  8.  
  9. DATA _NULL_;
  10. file print PS=32767;
  11. set WAT end=lastrec;
  12. if _N_ eq 1 then do;
  13. put '[';
  14. end;
  15. put '{"productName":"' PRODUCT_NAME '",';
  16. put '"lotId":"' LOT_ID '",';
  17. put '"waferId":' WAFER_ID ',';
  18. put '"siteId":"' SITE_ID '",';
  19. put '"specFile":"' SPEC_FILE '",';
  20. put '"attrs": [';
  21. put '{"attr1":' ATT1 '},';
  22. put '{"attr2":' ATT2 '},';
  23. put '{"attr3":' ATT3 '}]}';
  24.  
  25. if lastrec eq 1 then do;
  26. put ']';
  27. end;
  28. else do;
  29. put ',';
  30. end;
  31. RUN;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.