03-08-2018 07:53 PM
I have a dataset that has variable that is originally a numeric in the sql server I pull it from. I want to change this variable to a character without changing the order of the variables. I know of the put/drop/rename syntax like this:
orig_var = 189;
new_var = put(orig_var,8.);
rename new_var = orig_var;
But i am trying to do this without having the variables change order, and the above syntax moves the "new_var" to the end of the dataset.
that dataset looks like this:
my goal is to have "month" changed to a character value without having to use a RETAIN step afterwards to regain the original order of the variables.
Thank you for any help you could provide.
03-08-2018 10:16 PM
proc sql; create table WANT as select VAR1, VAR2, put(VAR3,8.) as VAR3, VAR4 from HAVE; run;
03-09-2018 03:40 AM
You may get away with using the DBSASTYPE option:
data new; set dblib.mydata(dbsastype=(orig_var='CHAR(8)')); run;