Can somebody help me to convert this code to Data Step or Proc SQL?
SAS code:
data cd;
set ab (rename=(x_ID=ID x_num=num x_year=year));
history_path = 0;
if _n_ = 1 then do;
length x_ID $9 x_num $3 x_year $4;
declare hash vertices(dataset: 'work.ab');
rc = vertices.definekey('x_ID', 'x_num', 'x_year');
rc = vertices.definedata('history');
rc = vertices.definedone();
call missing(x_ID, x_num, x_year, history);
length last_ID $9 last_num $3;
declare hash edges(dataset: 'work.ac', multidata: 'yes');
rc = edges.definekey('x_ID', 'x_num', 'x_year');
rc = edges.definedata('last_ID', 'last_num');
rc = edges.definedone();
call missing(last_ID, last_num);
end;
run;
Was this program working and now it isn't? If so have you tried increasing SAS's MEMSIZE option to provide more memory?
That data step does not appear to be using the HASH objects at all. Why not just remove that part of the code?
data cd;
set ab (rename=(x_ID=ID x_num=num x_year=year));
history_path = 0;
run;
What do you mean by "convert this code to Data Step" if it's already a DATA step?
As far as conversion to SQL goes, what's the purpose of the program? The only thing it currently does is load two data sets into two hash tables at _N_=1 and read the data from AB without processing the data in any way.
Kind regards
Paul D.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.