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_
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!
Try dividing by zero, log of a negative number, subscript out of bounds, or any other error condition.
Try dividing by zero, log of a negative number, subscript out of bounds, or any other error condition.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.