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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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