BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DavidPhillips2
Rhodochrosite | Level 12

What is the syntax for printing a variable in a SAS program? I know how to do this in a stored process but looking for the syntax for a program.

 

data enrollment; set enrollment;
length yearToNull $4.;
if(substr(max_academic_period, 5, 2) ne '30') then do;
yearToNull = substr(max_academic_period, 1, 4);
/*put yearToNull;*/
if(substr(academic_period, 1,4) = yeartoNull) then Annual_FTE = 0;
end;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

What you have done, the "put yeartonull;" should work?

http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#n1spe7nmkmi7ywn...

 

data _null_;
  set sashelp.cars;
  put make;
run;

View solution in original post

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

Do you want to print it to the log or to the Results Viewer?

DavidPhillips2
Rhodochrosite | Level 12

I'm trying to see it in the log.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

What you have done, the "put yeartonull;" should work?

http://support.sas.com/documentation/cdl/en/lestmtsref/69738/HTML/default/viewer.htm#n1spe7nmkmi7ywn...

 

data _null_;
  set sashelp.cars;
  put make;
run;
DavidPhillips2
Rhodochrosite | Level 12

Thank RW9, apparently I was running into another condition that was making my put statement not show up, and thought I had the syntax for the basic put statement wrong.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 4 replies
  • 822 views
  • 0 likes
  • 3 in conversation