IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

SAS: How can use variable of one datastep in other datastep?


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Laxminarsimharao

New User


Joined: 08 May 2007
Posts: 26
Location: hyderabad

PostPosted: Wed Oct 24, 2007 12:44 pm
Reply with quote

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
View user's profile Send private message
Alan Voss

New User


Joined: 29 Nov 2006
Posts: 32
Location: Jacksonville, FL

PostPosted: Wed Oct 24, 2007 6:59 pm
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Oct 25, 2007 1:56 am
Reply with quote

You can also pass the value via a macro variable.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Oct 25, 2007 2:20 am
Reply with quote

Hi PP,

Welcome back icon_biggrin.gif

d
Back to top
View user's profile Send private message
Alan Voss

New User


Joined: 29 Nov 2006
Posts: 32
Location: Jacksonville, FL

PostPosted: Thu Oct 25, 2007 2:28 am
Reply with quote

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
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Oct 25, 2007 5:44 pm
Reply with quote

Thanks Dick. Been super busy on two (count 'em - 2) projects!
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
No new posts parsing variable length/position data... DFSORT/ICETOOL 5
No new posts Masking variable size field - min 10 ... DFSORT/ICETOOL 4
Search our Forums:

Back to Top