BookmarkSubscribeRSS Feed
jbanas
Calcite | Level 5

In teradata, you can see the table definition by running a show table xxx to get the contents on how it was created.  In SAS you can also run this same code that writes out the contents to a table or perform a describe xxx which produces the code in a log.  what i was looking to do is utilize SAS to read this code to recreate the table to perform a comparison on another table.  The columns could always change so i want to make it as dynamic as possible.  Waht would be the most efficient way to build a new table off of the describe statement.

3 REPLIES 3
BrunoMueller
SAS Super FREQ

If you just want to create a new table that has the same structure as the old table, you can use

create table newTable like oldTable;

See also this sample code here:

data newCars;
  seqNr = _n_;
  set sashelp.cars;
run;

proc sql;
  create index seqNr on newcars;
  describe table newCars;
  create table newCars2 like newCars;
  describe table newCars;
quit;

Bruno

jbanas
Calcite | Level 5
Thanks for the reply Bruno, ultimately I would take the column attributes that would build the table on Teradata


LinusH
Tourmaline | Level 20
Perhaps you should look for Teradata tools instead...
Data never sleeps

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
  • 3 replies
  • 816 views
  • 0 likes
  • 3 in conversation