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

Hi all,

 

I just learnt from @Reeza  a good tool regarding put_all_; to see what seemingly works behind the scene.

So, in the compilation step, after the input buffer is the PDV step. In this step, SAS will create two automatic variables named _N_ and _ERROR_

ResoluteCarbon_0-1617314143490.png

 

 

I am wondering how to adjust the code below to see _error_ different from 0.

data storm_complete;
	set pg2.storm_summary_small;
	length Ocean $ 8;
	where Name is not missing;
	Basin=upcase(Basin);
	StormLength=EndDate-StartDate;

	if substr(Basin,2,1)="I" then
		Ocean="Indian";
	else if substr(Basin,2,1)="A" then
		Ocean="Atlantic";
	else Ocean="Pacific";
	drop EndDate;
	put _all_;
run;

The log is

Name=AGATHA Basin=EP MaxWind=115 StartDate=09JUN1980 EndDate=15JUN1980 StormLength=6
Ocean=Pacifi _ERROR_=0 _N_=1
Name=ALBINE Basin=SI MaxWind=. StartDate=27NOV1979 EndDate=06DEC1979 StormLength=9 Ocean=Indian
_ERROR_=0 _N_=2
Name=ALEX Basin=WP MaxWind=40 StartDate=09OCT1980 EndDate=14OCT1980 StormLength=5 Ocean=Pacifi
_ERROR_=0 _N_=3

I tried to delete some semicolon but the code just stop working rather than announce the _error_ different from 0.

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenKuhfeld
Ammonite | Level 13

Try dividing by zero, log of a negative number, subscript out of bounds, or any other error condition.

View solution in original post

1 REPLY 1
WarrenKuhfeld
Ammonite | Level 13

Try dividing by zero, log of a negative number, subscript out of bounds, or any other error condition.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 758 views
  • 1 like
  • 2 in conversation