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.  

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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