1 / 6

Creating Macro Variables from PROC SQL

Creating Macro Variables from PROC SQL. Presented by Faisal Dosani. Standard SQL Statement . PROC SQL; SELECT myVar FROM myDataset WHERE ID = 1 ; QUIT;. Macro Facility with SQL Statement . PROC SQL; SELECT myVar INTO :myVar FROM myDataset WHERE ID = 1 ; QUIT;.

binta
Download Presentation

Creating Macro Variables from PROC SQL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Creating Macro Variables from PROC SQL Presented by Faisal Dosani

  2. Standard SQL Statement PROC SQL; SELECT myVar FROM myDataset WHERE ID = 1 ; QUIT;

  3. Macro Facility with SQL Statement PROC SQL; SELECT myVar INTO :myVar FROM myDataset WHERE ID = 1 ; QUIT; You can now use &myVar. in your code after running this SQL statement

  4. Multiple variables are Selected PROC SQL; SELECT myVar, anotherVar INTO :myVar, :anotherVar FROM myDataset WHERE ID = 1 ; QUIT; You can now use &myVar and &anotherVar. in your code after running this SQL statement

  5. Multiple rows are returned PROC SQL; SELECT myVar INTO :myVar1 THROUGH :myVar10 FROM myDataset ; QUIT; SAS will create multiple macro variables name &myVar1 to &myVar10.

  6. Using separators PROC SQL; SELECT myVar INTO :myVar SEPERATED BY ‘ , ’ FROM myDataset ; QUIT; SAS will create one macro variable which has all the rows separated by ,

More Related