Dear all,
How can i send output of x statement into
a dataset. By using the below code the dataset is created
but i am unable to open the dataset.
X 'man bdf>>/sys/man.sas7bdat';
X 'bdf>>/sys/bdf.sas7bdat';
'bdf' and 'df' are pretty much the same thing, they have a different default block-size is all, I think. The 'man' command requests the manual information for a command, and I cannot be sure what purpose this is being called for.
KarthikSrivasthav wrote:
X 'man bdf>>/sys/man.sas7bdat';
X 'bdf>>/sys/bdf.sas7bdat';
These commands will create two text files in /sys/ with the erronious extention of sas7bdat. Just using the sas dataset extention does not convert this output to a valid data format for SAS.
The way you will want to accomplish this task is to use filename statement with the pipe engine to read the stdout from the system commands into a SAS data step.
filename foo pipe 'df -hTP';
data foo;
infile foo lrecl=512 firstobs=2 truncover;
input (filesystem type size used avail usepct mounted_on) (:$64.);
run;
It would help if you can post more details. what do you have in 'bdf'?
Bdf or df command will give details about data usage and the percent of data occupied
in the server according to directory and file wise
The best approach would be moving the results to text file and then converting the text file to data set. Give it a try.
Hima i already tried that way i got the result
But i need to send directly to a sas data set
Can you post the results of man bdf? It would greater visibilty for me to help you solve this.
I don't know what man or bdf do. Do they result in sas files or text files or something else?
'bdf' and 'df' are pretty much the same thing, they have a different default block-size is all, I think. The 'man' command requests the manual information for a command, and I cannot be sure what purpose this is being called for.
KarthikSrivasthav wrote:
X 'man bdf>>/sys/man.sas7bdat';
X 'bdf>>/sys/bdf.sas7bdat';
These commands will create two text files in /sys/ with the erronious extention of sas7bdat. Just using the sas dataset extention does not convert this output to a valid data format for SAS.
The way you will want to accomplish this task is to use filename statement with the pipe engine to read the stdout from the system commands into a SAS data step.
filename foo pipe 'df -hTP';
data foo;
infile foo lrecl=512 firstobs=2 truncover;
input (filesystem type size used avail usepct mounted_on) (:$64.);
run;
Thanks
Its working
As FriedEgg said, you need PIPE .
filename x pipe 'dir c:\'; data want; infile x length=len; input row $varying200. len ; run;
Ksharp
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.
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.