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

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!!!

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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

4 REPLIES 4
Tom
Super User Tom
Super User

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;

Mathan
Calcite | Level 5

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

LarryWorley
Fluorite | Level 6

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:-)

twocanbazza
Quartz | Level 8

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

Barry

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

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