DATA Step, Macro, Functions and more

Printing variable in SAS program

Accepted Solution Solved
Reply
Super Contributor
Posts: 480
Accepted Solution

Printing variable in SAS program

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;


Accepted Solutions
Solution
a week ago
Super User
Super User
Posts: 7,392

Re: Printing variable in SAS program

[ Edited ]

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


All Replies
PROC Star
Posts: 549

Re: Printing variable in SAS program

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

Super Contributor
Posts: 480

Re: Printing variable in SAS program

I'm trying to see it in the log.

Solution
a week ago
Super User
Super User
Posts: 7,392

Re: Printing variable in SAS program

[ Edited ]

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;
Super Contributor
Posts: 480

Re: Printing variable in SAS program

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.

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 67 views
  • 0 likes
  • 3 in conversation