Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 967
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: 967
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 Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us