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: 964
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: 964
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 Can I traverse a STEM variable? chong.zhou CLIST & REXX 5 Wed May 31, 2017 3:54 pm
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Count Trailing Spaces in variable str... Virendra Shambharkar SYNCSORT 10 Thu Feb 02, 2017 12:23 pm


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