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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 2558 views
  • 0 likes
  • 5 in conversation