1. I have a simple index defined on var1 in sas data set : one
2. when appending the data to the sas dataset in step1 with the new data set for ex: two the index that is already defined for the dataset one is lost.
please see the below code.
data class(index=(name/unique)); /* index created on name in the work.class*/
set sashelp.class;
run;
proc contents data=class;
quit;
data class1; /* index is not there in the work.class1*/
set class (where= (name = 'Alfred'));
run;
proc contents data=class1;
run;
data class;
set class class1 ;
run;
proc contents data=class; /* index is lost in work.class*/
quit;
kindly let me if I am doing some thing wrong.
Yes, since you’re creating a new data set. It happens to have the same name but that’s coincidental - and bad practice IMO.
Try PROC APPEND or DATASETS
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.