labradorchik
asked on
How to open SAS dataset in Unix bash shell script and extract a certain variable from that dataset?
I am looking for an example of how to open .DAT in the Unix bash shell script and then extract a particular variable from that .DAT file into a different file.
Please note: this is how this function was done in VAX DCL code
Any examples or comments on how this might be done in the Unix bash shell script will be greatly appreciated!!
Please note: this is how this function was done in VAX DCL code
open/read indat myfile.dat
read_loop:
read/end_of_file=endit indat var1
var2=f$extract(0,2,var1)
if f$search("mydir1:file2.s''var2'") .nes. " "
then
del mydir1:file2.s'var2';*
endif
endit:
close indat
del myfile.dat;*
Any examples or comments on how this might be done in the Unix bash shell script will be greatly appreciated!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
noci, thank you very much for your help!!!
I probably will use your example #2. Looks very different from the VAX DCL code.
I probably will use your example #2. Looks very different from the VAX DCL code.
example1 & 2 stay relatevely close to the DCL original...
example 3 is most unix like...
And you're right bash shell doesn't look like DCL.
example 3 is most unix like...
And you're right bash shell doesn't look like DCL.
ASKER
Thank you for your comments!!
could you please give an example what you want to extract
maybe this helps:
grep " mydir1" myfile.dat