BookmarkSubscribeRSS Feed
paulrockliffe
Obsidian | Level 7

I have the programme below that I use in Enterprise Guide to subset a massive table.  I want to add some calculated fields at the same time, to allow me to subset the table further for various conditions.

 

How do I do that?

 

data WORK.EXAMPLE (keep = Var1 Var2 Var3 Var4 Var5) ;

 

if 0 then set WORK.HASH WORK.SOURCE;

if _n_ = 1 then do;

declare hash l (dataset:"WORK.HASH");
l.definekey("Var2");
l.definedata("Var2r", "Var1", "Var3");
l.definedone();

end;

set WORK.SOURCE ;

if l.find() = 0

Output;

Run;

 

I can do it quite easily with Query Builder, but I'm trying to avoid creating a second copy of the data on my server - The initial subset creates a 14Gb file, so it's not one to duplicate!

 

Thanks.

5 REPLIES 5
paulrockliffe
Obsidian | Level 7

Thanks, you couldn't just add a quick example for me, I'm not sure I really have the syntax for this straight in my head!

 

Cheers

paulrockliffe
Obsidian | Level 7

Thanks,  I'm creating a key by concatenating two of my variables and a flag that is 1 if one of the variables is over 100.

 

I want to add those as new variables rather than subsetting directly as I'm running a few different operations from the resulting dataset.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 5 replies
  • 1107 views
  • 0 likes
  • 2 in conversation