BookmarkSubscribeRSS Feed
Uli
Calcite | Level 5 Uli
Calcite | Level 5
Dear All,

Can you please help me out of this issue.

I hacve created sample.sas program, please find the program below.
sample.sas program :

data a;
input a $5.;
datalines;
hello
howru
;

proc sql;
select a into :id separated by ',' from a ;
quit;


data _null_;
call system('export var="&id."');
run;

I have created samp.sh program , here i am executing the sample.sas program and print the output from SAS program in UNIX environment. I am not getting the result.

*shell Script:
samp.sh

#!/usr/bin/ksh

sas sample.sas

echo $var




Could you please help me out about the above issue. I have used X command as well.

Thanks In Advance.

Best Regards
4 REPLIES 4
Peter_C
Rhodochrosite | Level 12
might try replacing
call system('export var="&id."');
with
call system("export var=""&id.""");
If the shell script command "export" supports single quotes, then use
call system("export var='&id.'");
Ksharp
Super User
Maybe You can code like this:
[pre]


data a;
input a $5.;
datalines;
hello
howru
;
run;
data _null_;
set a end=last;
file '/usr/bin/ksh/samp.sh';
length id $ 500;
retain id;
id=catx(' ',a);
if last then do;
envir_var='export var='||id;
put envir_var;
end;
run;

[/pre]


Ksharp
Clarke_Thacher
SAS Employee
The reason why this is so difficult is because environment variables are inherited by the child process but the parent process is unaffected by the child process.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 2533 views
  • 0 likes
  • 5 in conversation