BookmarkSubscribeRSS Feed
sasuser1031
Calcite | Level 5

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;

 

4 REPLIES 4
SASKiwi
PROC Star

Was this program working and now it isn't? If so have you tried increasing SAS's MEMSIZE option to provide more memory?

sasuser1031
Calcite | Level 5
How to increase MEMSIZE?
Tom
Super User Tom
Super User

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;
hashman
Ammonite | Level 13

@sasuser1031:

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.  

SAS Innovate 2025: Register Now

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!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 931 views
  • 0 likes
  • 4 in conversation