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 (August 2008, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 22 Aug 2008 13:36:06 -0700
Reply-To:     Lauren <maillauren@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Lauren <maillauren@GMAIL.COM>
Organization: http://groups.google.com
Subject:      subsetting data with a macro?
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

Does anyone know how to use an array or a macro to subset data?

I have 4 datasets to join: a_2003 a_2004 a_2005 a_2006 and I have 10 consecutive variables in each dataset, the 1st variable is called 'dgiar' the 10th is 'dshig'. I want to create 10 new datasets, each containing records for all four years but only if each of the ten variables is '1'. So the first new dataset will be called dgiar_new and contain only records from all four years where diar=1. Then I need to repeat that nine times for the other nine variables. Is there a way to use the variable names like you would a number in a do loop?

Not sure if this is clear enough to evoke any help... Thanks in advance.


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