- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Posted 05-16-2011 08:39 AM
(3038 views)
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
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.'");
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.'");
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
[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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Check this SAS Note: http://support.sas.com/kb/9/089.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.