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 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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