- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data Porto; input apple lemon orange; datalines; 1 2 3 2 3 4 3 4 5 1 5 5 3 0 0 6 0 0 7 0 0 run; PROC SQL; create table result as SELECT DISTINCT count(*) into :total FROM Porto; QUIT; proc print data=result; run;
if I skip the line "create table result as" Is the code not gonna to save any output? is it just gonna showing in the log whatever is identified?
what does count(*) into :total means? is it just total number of rows in table Porto? what is :total? this is looking very strange I tried the code and the output is very strange too...
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
SELECT INTO is the method to create macro variables from SQL. So your step creates macro variable &total which holds the count of all observations in the dataset porto.
The DISTINCT in your query serves no purpose (there is only one count anyway), so remove it. Without a CREATE TABLE, only the macro variable and the print output are created. When the sole purpose of the step is to create the macro variable, run PROC SQL with the NOPRINT option.