LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (October 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Sun, 22 Oct 2006 11:09:17 -0400
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:   Re: Using value of variable in SET statement

On Fri, 20 Oct 2006 17:24:57 -0400, Wendi Wright <wendi_wright@CTB.COM> wrote:

>Here is an example of what I would like to do: > >I have multiple datasets - one for each testlet that I want to use to pull >information from. There will be over 100 testlets or more. Then I am >going want to combine it with another dataset using with different >informational variables. This is a simplified example.

It looks like a horizontal concatenation problem. I think I grasp that, but I do have some questions.

> >data MA04A RD04A SC04A; > studentid=1;x='a';output; > studentid=2;x='b';output; >run;

All three data sets have the satellite variable X. Shouldn't they have *different* satellite variables, to avoid collisions?

> >With the following as the "key" table (may have more variables)

More variables? This already specifies which observations to get from which tables.

> >data StudTlet; > input StudentID > TestNam $ > TestLet $ > ; >cards; >0001 FormA MA04A >0001 FormA RD04A >0002 FormX MA04X >0002 FormX SC04Y >0002 FormX RD04Z >; >run; > >I now want to do something like: > >data loop; > set StudTlet; > set "value of variable TestLet" key=StudentId; >run; > > > >Which would hopefully execute/loop through the following five statements; > >set MA04A key=StudentId; >set RD04A key=StudentId; >set MA04X key=StudentId; >set SC04Y key=StudentId; >set RD04Z key=StudentId;

However, StudentId is =1 for the first 2 of these and =2 for the last 3. At the boundary, don't you want to output an observation and clear the PDV? Otherwise data for two student will be mixed together?

How many observations should emerge? One for each distinct StudentID in StudTlet?

> >The problem is you can't use a dataset variable in the SET statement, so >we've been playing around with trying out alternatives. > >We've played with using call symput and resolve or symget and can't get >that to work. We've tried making a macro that will just print out the >text that we feed it and haven't got that to work either. We looked at >making one macro variable for each kid, but there are up to 5 million kids >and that will take up a lot of space and time for a job so we are looking >for something a little more efficient. > >We are currently testing out using a format in some way. > >We've also talked about doing the merges in different ways (using proc sql >or even a merge statement), but have not tested code yet. > >Any help or suggestions would be appreciated. > >Thanks, >Wendi


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