BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
W1ndwaker
Obsidian | Level 7

Hello all,

 

i'm trying to figure out if it's possible to convert a dataset file, for example, like this:

 

Example.sas7bdat

col1      |  col 2

a           |      b

a1          |     b1

 

 

into a description file, like you do with oracle, that would look like a datastep proces;

 

data example;

attrib col1 format=$4.;

attrib col2 format $4.;

 

col1=a;

col2=b;

output;

 

col1=a1;

col2=b1;

output;

 

run;

 

 

is it possible to create this kind of description file form a dataset with a procedure?

 

thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Amir
PROC Star

Hi,

 

There is a blog post on this topic which might help:

 

The DATA to DATA Step Macro 

 

 

Thanks & kind regards,

Amir.

View solution in original post

4 REPLIES 4
Amir
PROC Star

Hi,

 

There is a blog post on this topic which might help:

 

The DATA to DATA Step Macro 

 

 

Thanks & kind regards,

Amir.

W1ndwaker
Obsidian | Level 7
Hi!!

have to say this is very much what i wanted, thanks for the enlightnement!
LinusH
Tourmaline | Level 20

Closer to your Oracle anology, there is PROC SQL DESCRIBE TABLE statment, which will give you CREATE TABLE/INDEX in the SAS log.

SAS Help Center: Syntax: PROC SQL DESCRIBE Statement

Data never sleeps
W1ndwaker
Obsidian | Level 7
i will combine the precedure below with the describe to create the table and then if it has indexes it will be recreated too automatically.

sas-innovate-2024.png

 

Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.

 

Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 

 

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
  • 264 views
  • 2 likes
  • 3 in conversation