View previous topic :: View next topic
|
Author |
Message |
Laxminarsimharao
New User
Joined: 08 May 2007 Posts: 26 Location: hyderabad
|
|
|
|
In my SAS program,
In one data step variable ABC is assigned to ‘Y’ .
My requirement is I need to use same variable ABC with same value assigned in above data step in my another Data step.
How can I use it in another Data step? |
|
Back to top |
|
|
Alan Voss
New User
Joined: 29 Nov 2006 Posts: 32 Location: Jacksonville, FL
|
|
|
|
Can you elaborate, please?
Code: |
data first;
ABC = 'Y';
do DEF=1 to 10;
output;
end;
run;
/* above yields 10 observations with variables DEF (1-10) and ABC='Y' */
data second;
set first; /* reads everything from first. Variable ABC='Y' */
if mod(DEF,2) = 1 then GHI = ABC; /* if DEF is odd then GHI=ABC='Y'*/
else GHI = 'N'; /* if DEF is even then GHI='N' */
run;
/* yields 10 observations with variables DEF (1-10) ABC='Y' */
/* and GHI either 'Y' or 'N' depending on whether DEF is odd or even */
|
|
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
You can also pass the value via a macro variable. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi PP,
Welcome back
d |
|
Back to top |
|
|
Alan Voss
New User
Joined: 29 Nov 2006 Posts: 32 Location: Jacksonville, FL
|
|
|
|
Yes,
Phrzby Phil wrote: |
You can also pass the value via a macro variable. |
but we still really need to know the end goal to successfully help solve this issue. |
|
Back to top |
|
|
Phrzby Phil
Senior Member
Joined: 31 Oct 2006 Posts: 1042 Location: Richmond, Virginia
|
|
|
|
Thanks Dick. Been super busy on two (count 'em - 2) projects! |
|
Back to top |
|
|
|