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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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