Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: SAS: How can use variable of one datastep in other datastep?
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    Post subject:
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

Active Member


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

PostPosted: Thu Oct 25, 2007 1:56 am    Post subject:
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

Site Director


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

PostPosted: Thu Oct 25, 2007 2:20 am    Post subject: Reply to: SAS: How can use variable of one datastep in other
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    Post subject:
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

Active Member


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

PostPosted: Thu Oct 25, 2007 5:44 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Format to pipe delimited with variabl... pshongal SYNCSORT 6 Wed Sep 14, 2016 2:48 pm
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am
No new posts OPC JCL Variable passion_sujesh IBM Tools 5 Fri Jul 01, 2016 4:21 am
No new posts JOINKEYs and Variable files migusd SYNCSORT 8 Fri Jun 17, 2016 3:16 am
No new posts File Manager with Variable Length File ahabib IBM Tools 10 Thu Mar 31, 2016 11:00 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us