BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

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';

1 ACCEPTED SOLUTION

Accepted Solutions
FriedEgg
SAS Employee

'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;

View solution in original post

9 REPLIES 9
Hima
Obsidian | Level 7

It would help if you can post more details. what do you have in 'bdf'?

KarthikSrivasthav
Calcite | Level 5

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

Hima
Obsidian | Level 7

The best approach would be moving the results to text file and then converting the text file to data set. Give it a try.

KarthikSrivasthav
Calcite | Level 5

Hima i already tried that way i got the result

But i need to send directly to a sas data set

Hima
Obsidian | Level 7

Can you post the results of man bdf? It would greater visibilty for me to help you solve this.

art297
Opal | Level 21

I don't know what man or bdf do.  Do they result in sas files or text files or something else?

FriedEgg
SAS Employee

'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;

KarthikSrivasthav
Calcite | Level 5

Thanks

Its working

Ksharp
Super User

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 9 replies
  • 1739 views
  • 0 likes
  • 5 in conversation