The following code:
data work.ar WORK.BAD_DATA / view=WORK.BAD_DATA ;
set SASUSER.acities;
length _Check_ $ 10 ;
if name='' then _check_=" Missing" ;
put name= _check_= ;
run;
The code generates work.AR data set and
WORK.BAD_DATA
view.
The question is:
Why is the PUT statement not displayed in the log window after submitting the code?
But the code you posted did NOT create AR. It created a view named BAD_DATA. When you reference that view you will get AR as a side effect.
922 data work.ar WORK.BAD_DATA / view=WORK.BAD_DATA ; 923 set sashelp.class ; 924 length _Check_ $ 10 ; 925 if name='' then _check_=" Missing" ; 926 put name= _check_= ; 927 run; NOTE: DATA STEP view saved on file WORK.BAD_DATA. NOTE: A stored DATA STEP view cannot run under a different operating system. NOTE: DATA statement used (Total process time): real time 0.05 seconds cpu time 0.00 seconds 928 data _null_; 929 set ar; ERROR: File WORK.AR.DATA does not exist. 930 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 931 932 data _null_; 933 set bad_data; 934 run; Name=Alfred _Check_= Name=Alice _Check_= Name=Barbara _Check_= Name=Carol _Check_= Name=Henry _Check_= Name=James _Check_= Name=Jane _Check_= Name=Janet _Check_= Name=Jeffrey _Check_= Name=John _Check_= Name=Joyce _Check_= Name=Judy _Check_= Name=Louise _Check_= Name=Mary _Check_= Name=Philip _Check_= Name=Robert _Check_= Name=Ronald _Check_= Name=Thomas _Check_= Name=William _Check_= NOTE: View WORK.BAD_DATA.VIEW used (Total process time): real time 0.05 seconds cpu time 0.01 seconds NOTE: There were 19 observations read from the data set SASHELP.CLASS. NOTE: The data set WORK.AR has 19 observations and 6 variables. NOTE: There were 19 observations read from the data set WORK.BAD_DATA. NOTE: DATA statement used (Total process time): real time 0.11 seconds cpu time 0.01 seconds 935 936 data _null_; 937 set ar; 938 run; NOTE: There were 19 observations read from the data set WORK.AR. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
But the code you posted did NOT create AR. It created a view named BAD_DATA. When you reference that view you will get AR as a side effect.
922 data work.ar WORK.BAD_DATA / view=WORK.BAD_DATA ; 923 set sashelp.class ; 924 length _Check_ $ 10 ; 925 if name='' then _check_=" Missing" ; 926 put name= _check_= ; 927 run; NOTE: DATA STEP view saved on file WORK.BAD_DATA. NOTE: A stored DATA STEP view cannot run under a different operating system. NOTE: DATA statement used (Total process time): real time 0.05 seconds cpu time 0.00 seconds 928 data _null_; 929 set ar; ERROR: File WORK.AR.DATA does not exist. 930 run; NOTE: The SAS System stopped processing this step because of errors. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds 931 932 data _null_; 933 set bad_data; 934 run; Name=Alfred _Check_= Name=Alice _Check_= Name=Barbara _Check_= Name=Carol _Check_= Name=Henry _Check_= Name=James _Check_= Name=Jane _Check_= Name=Janet _Check_= Name=Jeffrey _Check_= Name=John _Check_= Name=Joyce _Check_= Name=Judy _Check_= Name=Louise _Check_= Name=Mary _Check_= Name=Philip _Check_= Name=Robert _Check_= Name=Ronald _Check_= Name=Thomas _Check_= Name=William _Check_= NOTE: View WORK.BAD_DATA.VIEW used (Total process time): real time 0.05 seconds cpu time 0.01 seconds NOTE: There were 19 observations read from the data set SASHELP.CLASS. NOTE: The data set WORK.AR has 19 observations and 6 variables. NOTE: There were 19 observations read from the data set WORK.BAD_DATA. NOTE: DATA statement used (Total process time): real time 0.11 seconds cpu time 0.01 seconds 935 936 data _null_; 937 set ar; 938 run; NOTE: There were 19 observations read from the data set WORK.AR. NOTE: DATA statement used (Total process time): real time 0.00 seconds cpu time 0.00 seconds
Not sure how you are using this, but it would make more sense to me to have the view be named AR and BAD_DATA be the side effect dataset that is generated. Then when you use the AR view for your analysis you will automatically get the BAD_DATA dataset also and you can then take any required action on that.
Show the entire log from running that data step.
Hint: to check for missing values use the proper function: Missing;
if missing(name) then _check_=" Missing" ;
Missing works with both character and numeric values and you don't have to worry about using the incorrect comparison for your value.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.