LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (April 2007, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 2 Apr 2007 11:39:10 -0400
Reply-To:     Richard Reeves <reeves@STUDENTCLEARINGHOUSE.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Richard Reeves <reeves@STUDENTCLEARINGHOUSE.ORG>
Subject:      Re: How to filter sas data sets into separate sas data sets
Comments: To: starsoul@mindspring.com
In-Reply-To:  A<32903572.1175525588221.JavaMail.root@mswamui-cedar.atl.sa.earthlink.net>
Content-Type: text/plain; charset="US-ASCII"

Something like this is the old way. You could use a proc sql if you have a new enough version. Increase your buffersize and if you have enough memory you may get it into a hash routine.

DATA WORK.NEW; MERGE small (IN=A OBS=500) big ; BY ID_FIELD; IF A=1; RUN; QUIT;

RICH -----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@listserv.vt.edu] On Behalf Of Lizette Koehler Sent: Monday, April 02, 2007 10:53 AM To: SAS-L@LISTSERV.VT.EDU Subject: How to filter sas data sets into separate sas data sets

Listers,

This is my failing point in coding SAS. The use of 2 separate SAS data sets to create a third.

I can do this in a program with nested Do loops. But with SAS it is just different enough I seem to be unable to see the coding technique.

Problem:

Sas Data set 1 contains 1 variable and 1000 obs. Sas Data set 2 contains 15 variables and 500000 obs.

I need to filter off the data in Sas data set 2 based on Sas data set 1

Node1, Node2 and Node3 must match VAR1 exactly. I have all the code I need to do this except for splitting the data into a separate SAS data set (NEWLISTS).

Psuedo code:

Sas Data set 1: Var1 Length 7 Char Sas Data set 2: Node1 Length 1-8 Char Node2 Length 1-8 Char Node3 Length 1-8 Char

Data Newlist (KEEP=node1 node2 node3 ... var15) Otherds (Keep=node1 node2 node3 .... var15) ;

Set SASDS1 ; *Contains 1 var 1000 obs ; Set SASDS2 ; *Contains 15 vars and 500,000 obs ;

If Node1 = VAR1 or Node2 = VAR1 or Node3 = Var1 then Output Newlist ; Else Output Otherds ;

I have tried putting in two SET statements, but I seem to reduce the information dramatically. I have been reviewing the coding examples on the SAS Wesbsite as well as in the archives. I am just so crunched for time that I must lean on you for assistance.

I know this should be easy, I am just not seeing.

Thanks for the assistance

Lizette


Back to: Top of message | Previous page | Main SAS-L page