BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

Could you please tell me how to print the value of _n_  in log from the following code? I could not see the value of _n_ after placing the put _all_ statement.

 

if 1<_n_< %eval(&end_title) then do; put option;end;
put _all_;
if _n_=%eval(&end_title) then do; put option;end;	
put _all_;
5 REPLIES 5
ChrisNZ
Tourmaline | Level 20

This is in data step right?

 

put _ALL_;

will output all values including the value of _N_.

 

 

put _N_=;

will only output the value of _N_.

 

 

 

Babloo
Rhodochrosite | Level 12
I tried with put _n_ as well , but not getting the value of _n_ in log.
Reeza
Super User
Post your full code.
ChrisNZ
Tourmaline | Level 20

1- use putlog instead of put (if this works you are using a file statement somewhere)

2- do you see anything at all in the log (if not you have redirected the log)?

ballardw
Super User

And what is the value of &end_title? Use of %eval in a data step tells me something is being a tad over coded as if &end_title could have a value of 1+3 then the data step will take that just fine.

If the %eval (&end_title) yields a value of 0 or less then it would not put in either case.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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