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
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.