|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;
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
> input StudentID
> TestNam $
> TestLet $
>0001 FormA MA04A
>0001 FormA RD04A
>0002 FormX MA04X
>0002 FormX SC04Y
>0002 FormX RD04Z
>I now want to do something like:
> set StudTlet;
> set "value of variable TestLet" key=StudentId;
>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
>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.