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: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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