DATA Step, Macro, Functions and more

How to get the content of the SAS7bdat file with variable name of more than 8 Characters

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

How to get the content of the SAS7bdat file with variable name of more than 8 Characters

Hi,

     I need to get the property (content/Variables View) of *.SAS7BDAT files which consist of variable names of more than 8 characters.

when i tried the below code i'm able to get the xml from all the other sas7bdat files (where their variable names in that sas7bdat file is of maximum 8 characters only).

CODE :

ods xml file="C:\Users\sas\Desktop\text2.xml";

  proc contents data='C:\\Users\\sas\\Desktop\\SAS\\cal_sample.sas7bdat' out=contents DETAILS;

  run;

ods _all_ close;

In this 'cal_sample.sas7bdat' file its variable name length is of max 8 characters only, so i got the expected test2.XML as output and i proceessed it to get my output.And i can not get that expected XML for other files with more than 8 characters as its variable name.

I'm new to SAS and i knew few thing only about it. I'm in Need of help!!!


Accepted Solutions
Solution
‎01-11-2012 08:32 AM
Super User
Super User
Posts: 7,074

Re: How to get the content of the SAS7bdat file with variable name of more than 8 Characters

It works fine for simple test that I did.

Not sure why you would want the print-out from PROC CONTENTS as XML.

Why don't you export the dataset output by the proc as an XML file?  That would not have the confused format needed to convert it to listing.

libname out xml '~/test/contents.xml';

proc contents data=sashelp.class out=out.contents noprint ;

run;

libname out clear;

View solution in original post


All Replies
Solution
‎01-11-2012 08:32 AM
Super User
Super User
Posts: 7,074

Re: How to get the content of the SAS7bdat file with variable name of more than 8 Characters

It works fine for simple test that I did.

Not sure why you would want the print-out from PROC CONTENTS as XML.

Why don't you export the dataset output by the proc as an XML file?  That would not have the confused format needed to convert it to listing.

libname out xml '~/test/contents.xml';

proc contents data=sashelp.class out=out.contents noprint ;

run;

libname out clear;

Occasional Contributor
Posts: 7

Re: How to get the content of the SAS7bdat file with variable name of more than 8 Characters

Hi Tom,

     I'm totally new to SAS and after long R&D i tried with that code. And my hearty thanks to you. Where this is the one what exactly i'm looking for it....

Happy thanks Tom!!!

Mathan

Frequent Contributor
Posts: 129

Re: How to get the content of the SAS7bdat file with variable name of more than 8 Characters

Mathan,

Can you provide a copy of your sas log when you have this issue?  Also can you provide a copy of one of the problem data sets?

Both of those would be very helpful for tracking your problem.

thx:-)

Super Contributor
Posts: 356

How to get the content of the SAS7bdat file with variable name of more than 8 Characters

Have a look at the sashelp dictonary tables should contain information that you need to process this...

Barry

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 702 views
  • 0 likes
  • 4 in conversation