BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ahmej
Calcite | Level 5
I am writing the below statement:
%put ***&act*** ***&n***
I am supposed to recieve string and count in log but no result is showing also log is clear.
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

SASUSER.ADMIN is unlikely to exist. You may need to share the actual content of that data set as well.

 

Or use a set that should be available to most such as SASHELP.CLASS;

 

Proc sql;

Select distinct sex into:act separated by "@" from sashelp.class;
quit;
%let n=&sqlobs;

%put ***&act.*** ***&n.***;

SAS creates an automatic variable named SQLOBS that contains the number of results returned from the most recent Proc SQL query. So no actual need to do the extra Select count.

View solution in original post

7 REPLIES 7
novinosrin
Tourmaline | Level 20

Hello @Ahmej  Welcome to SAS communities. Can you please post your code that creates those macro variables and the log. Thank you

Astounding
PROC Star

This statement is incomplete.  If you would like it to execute, add a semicolon at the end of it:

 

%put ***&act*** ***&n***;
Ahmej
Calcite | Level 5
Still its not working
Ahmej
Calcite | Level 5
Proc sql;

Select distinct actlevel into:act seprated by "@" from sasuser.admit;

Select count(distinct actlevel) into:n from sasuser.admit;

%put ***&act**** ***&n*** ;
andreas_lds
Jade | Level 19

And now please post the complete log, using the window displayed when clicking on the {i} button - that way the format is maintained and the log stays readable.

ballardw
Super User

SASUSER.ADMIN is unlikely to exist. You may need to share the actual content of that data set as well.

 

Or use a set that should be available to most such as SASHELP.CLASS;

 

Proc sql;

Select distinct sex into:act separated by "@" from sashelp.class;
quit;
%let n=&sqlobs;

%put ***&act.*** ***&n.***;

SAS creates an automatic variable named SQLOBS that contains the number of results returned from the most recent Proc SQL query. So no actual need to do the extra Select count.

Ahmej
Calcite | Level 5
Thank you so much its working now.

I got my result👍👍

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1547 views
  • 1 like
  • 5 in conversation