BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
david27
Quartz | Level 8

I have this but i cannot put the ending bracket.

Can you please advise.

 

Thank You

 

options symbolgen mprint mlogic merror;
filename code temp;
data _null_;
   file code ;
  set sashelp.class(obs=10);
  if _n_=1 then put  "select name from sashelp.class where name in ("  @;
  else put ',' @;
  str = quote(strip(name),"'");
  put str ;
  if eof then put ");quit;";
run;
%macro tst_code;
proc sql;
%include code ;
%mend tst_code;
%tst_code;
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

You didn't provide a variable EOF that should indicate the end of the file.

 

  set sashelp.class(obs=10) end=eof;

The End= assigns end of data to the variable name following the =;

Without it your code 1) created a variable named EOF

2) with a missing value

and missing is never true so that put never occurred.

View solution in original post

1 REPLY 1
ballardw
Super User

You didn't provide a variable EOF that should indicate the end of the file.

 

  set sashelp.class(obs=10) end=eof;

The End= assigns end of data to the variable name following the =;

Without it your code 1) created a variable named EOF

2) with a missing value

and missing is never true so that put never occurred.

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
  • 1 reply
  • 311 views
  • 1 like
  • 2 in conversation