Hello,
I am using a proc copy to copy a spde dataset from staging to dev (just the data structure).
Here's the code:
libname sauto spde 'path1';
libname sprop spde 'path2';
libname dauto spde 'path3';
libname dprop spde 'path4';
options obs=0;
proc copy in=sauto out=dauto;
select wc_auto_inforcesep2020 ;
run;
Is there a way to add a new variable such as format newvar $2. to a spde dataset, maybe with proc copy????
Thanks in advance for your help
No, you can't make any structural changes with proc copy. For this, you need a data step, or COPY and then ALTER TABLE in SQL. My observation was that ALTER TABLE still needs to rewrite the whole dataset, so, performancewise, you will be better off by using a DATA step to copy a dataset to SPDE and add a variable on the way.
There is no real difference between managing SPDE and Base SAS data sets.
The sImple answer is no.
What you can do is do the PROC COPY, and then SQL ALTER TABLE.
The table will be recreated, but that's probbaly fine since it's just the structure, not a mssive amount of data.
@LinusH wrote:
The table will be recreated, but that's probbaly fine since it's just the structure, not a mssive amount of data.
It will rewrite the whole table; with SAS, any structural change requires this.
Given the relative performance of SPDE libraries (thanks to threading), this will be considerably faster than changing a V9 dataset.
I just ran a test with a larger dataset here; creating the dataset by copying from the V9 engine took 43 seconds, adding the column 15 seconds.
No, you can't make any structural changes with proc copy. For this, you need a data step, or COPY and then ALTER TABLE in SQL. My observation was that ALTER TABLE still needs to rewrite the whole dataset, so, performancewise, you will be better off by using a DATA step to copy a dataset to SPDE and add a variable on the way.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.