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
Ammonite | Level 13

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
Ammonite | Level 13

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

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 175 views
  • 2 likes
  • 3 in conversation