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

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 4 replies
  • 2600 views
  • 0 likes
  • 4 in conversation