DATA Step, Macro, Functions and more

SAS working on Linux

Reply
Occasional Contributor
Posts: 7

SAS working on Linux

Hi All,

I am stuck with a reqiuirment where I have to create one sas code from another sas code dynamically during run time in linux 

 

I need help urgently.

Many Thanks

Super User
Posts: 17,815

Re: SAS working on Linux

So what do you need help with?

That's an incredibly broad topic but you can definitely:

 


 


create one sas code from another sas code dynamically during run time in linux 

 

Occasional Contributor
Posts: 7

Re: SAS working on Linux

thanks Reeza,

actually, when we read one file in sas code A and based on few conditions code A will create code B. so How the code from A will go to code B. As in the case of sas-mainframe where we dynamically create job from another job;there in the first job we give the code og 2nd job under "PUT AAAAA; " statement and once job1 is submitted it will create job2 with the code AAAA;

Super User
Posts: 17,815

Re: SAS working on Linux

You can dynamically create the code, place it in a text file in the work library and then use %include to call the program.

Occasional Contributor
Posts: 7

Re: SAS working on Linux

ok....but few fields in the 2nd job has to be changed based on the few conditions in the 1st job and the input file read..so how this change of certain fields in the 2nd job will be reflected dynamically 

PROC Star
Posts: 1,231

Re: SAS working on Linux

It would REALLY help if you gave an example. There are lots of possibilities for dynamic code generation in SAS (the %include method Reeza mentioned, macro language, CALL EXECUTE, etc). If you can give an example of the code you have, and the code you want to generate, that would help. Would also help to explain the problem you are trying to solve. Code generation is a useful technique, but depending on the problem being solved, may not be necessary.
Occasional Contributor
Posts: 7

Re: SAS working on Linux

ok..will try to elaborate my prob. I have one code A, from whcih I have to generate a code B. In code A, there is one field called Vendor_code. This code is reading one input file which has say 3 vendor codes. so based on few conditions code A will generate code B at the same time it will populate the value of vendor_code in the generated code i.e. code B. e.g. if there are 3 vendor codes then 3 set of codes will be generated from the 2st code A with the different values of vendor_code in code B

Super User
Posts: 17,815

Re: SAS working on Linux

Write a macro. Use call execute to call the macro that has the vendor codes.

 


PratapDeo wrote:

ok..will try to elaborate my prob. I have one code A, from whcih I have to generate a code B. In code A, there is one field called Vendor_code. This code is reading one input file which has say 3 vendor codes. so based on few conditions code A will generate code B at the same time it will populate the value of vendor_code in the generated code i.e. code B. e.g. if there are 3 vendor codes then 3 set of codes will be generated from the 2st code A with the different values of vendor_code in code B


 

Occasional Contributor
Posts: 7

Re: SAS working on Linux

Many thanks Reeza, will try your sugesstions.
Occasional Contributor
Posts: 7

Re: SAS working on Linux

Hi,

Could you please help me to get the syntax/format to submit another job from first job.

Like in SAS program we use SUB 'file-name' ;

Super User
Posts: 17,815

Re: SAS working on Linux

%INCLUDE

Occasional Contributor
Posts: 7

Re: SAS working on Linux

While using %INCLUDE file-name to run another program from the first program, I am getting the error message " File is in use" . Do I need to close the file.
Super User
Posts: 17,815

Re: SAS working on Linux

Your question is too broad. Yes you can do what you want is all we can tell you without further details. Mock up a test of what you need to do, which you should be doing anyways so you can test your process and post that information. 

 


PratapDeo wrote:

ok....but few fields in the 2nd job has to be changed based on the few conditions in the 1st job and the input file read..so how this change of certain fields in the 2nd job will be reflected dynamically 


 

Ask a Question
Discussion stats
  • 12 replies
  • 248 views
  • 0 likes
  • 3 in conversation