You need to explain what you are trying to do. Your program might succeed in getting user input from the console, but the value will be stored in an environment variable that the SAS code cannot access.
You might be able to retrieve the value entered by writing it to a file and then reading from the file. But you need to make sure the read command and the command that references the environment variable read run in the same sub-shell.
So if I create this program as read.sas.
data _null_;
call system ( 'echo -n "Sub setting condition:";read sub ; echo "Sub is $sub" >read.txt ' );
run;
data _null_;
infile 'read.txt';
input;
put _infile_;
run;
And run it using sas read. Then the SAS log looks like this:
1 data _null_;
2 call system ( 'echo -n "Sub setting condition:";read sub ; echo "Su
b is $sub" >read.txt ' );
3 run;
NOTE: DATA statement used (Total process time):
real time 2.80 seconds
cpu time 0.02 seconds
4 data _null_;
5 infile 'read.txt';
6 input;
7 put _infile_;
8 run;
NOTE: The infile 'read.txt' is:
Filename=.../test/read.txt,
Owner Name=xxxx,Group Name=xxx,
Access Permission=-rw-rw-r--,
Last Modified=05Apr2018:08:45:02,
File Size (bytes)=16
Sub is Hi there
NOTE: 1 record was read from the infile 'read.txt'.
The minimum record length was 15.
The maximum record length was 15.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
windowor%windowstatements. Or possibly learn SCL programming.readcommand if it is being run in a command shell launched by a running SAS program?readin the shell script and use the data to generate the SAS code to run? That might actually work, where what you are trying to do is very tricky. If you really need to have SAS read from terminal then try using stdin is your infile.