I want to identify the max value of one variable among all identical datasets (have same variables in each dataset) created and saved under work and exact the row. But got a note:
NOTE: A stored DATA STEP view cannot run under a different operating system.
data allscan/view = allscan;
set optimal_:indsname=dsname;
run;
proc sql;
create table min as
select * from allscan
having EN=min(EN);
quit;
NOTE: DATA STEP view saved on file WORK.ALLSCAN.
NOTE: A stored DATA STEP view cannot run under a different operating system.
NOTE: DATA statement used (Total process time):
real time 0.03 seconds
cpu time 0.01 seconds
ERROR: The following columns were not found in the contributing tables: EN.
NOTE: View WORK.ALLSCAN.VIEW used (Total process time):
real time 0.01 seconds
cpu time 0.01 seconds
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE SQL used (Total process time):
real time 0.03 seconds
cpu time 0.03 seconds
A Note is just a note, it doesn't signal an error. The error seems to be that at least one of your WORK.OPTIMAL_* datasets doesn't include a variable called EN. - PG
I used the %sysfunc to check the nobs and delete it if it is empty. But it seems that the empty datasets were still there.
%do i = 2 %to &maxN;
%joint(&i,&i); *** create table optimal_&i;
*** check if the data is empty;
%LET dsid=%SYSFUNC(OPEN(work.optimal_&i));
%LET nobs=%SYSFUNC(ATTRN(&dsid.,NOBS));
%LET rc=%SYSFUNC(CLOSE(&dsid.));
%IF &Nobs. EQ 0 %THEN %DO;
proc datasets;
delete optimal_&i;
run;
%END;
%end;
data allscan/view = allscan;
set optimal_:indsname=dsname;
run;
proc sql;
create table opt as
select * from allscan
having EN=min(EN);
quit;
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.
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.