Hello, I am unsure why the line: "order by t.month" is giving an error:
ERROR: File WORK.G.DATA does not exist.
Can someone help me to understand why?
libname G "/server/File/location";
libname O "&myfiles_root/file/location"Access=readonly;
%let RunYear = 2021;
%let DateA = 202108_211011;
%let DateB = 2021_202110;
data C;
set G.expdtrs_&RunYear._r&DateA.;
run;
data A;
set OSC.tcoc_part_a_&DateB.;
run;
data B;
set OSC.tcoc_part_b_&DateB.;
run;
/* Compare numbers*/
proc sql;
create table compare as
select t.month
,t.apple
,t.banana
,a.orange
,b.cherry
,case
when t.apple = a.orange
then 'YES'
else 'NO'
end as difference_a_o
,case
when t.banana = b.cherry
then 'YES'
else 'NO'
end as difference_b_c
from G t
left join A a
on t.month = a.month
left join B b
on t.month = b.month
order by t.month
;
quit;
Please show the full log.
Please show the code that is supposed to create the work dataset named G that your SQL code is trying to read from.
The code you posted defines a libref named G. It then correctly uses it to reference a dataset in that library to create a dataset named WORK.C. But there is not code show to create a dataset named G.
There does not appear to be any reason to create the datasets A, B, and C. Just reference the real datasets directly with your SQL code.
...
from G.expdtrs_&RunYear._r&DateA. t
left join OSC.tcoc_part_a_&DateB. a
on t.month = a.month
left join OSC.tcoc_part_b_&DateB. b
on t.month = b.month
...
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.