Hi All,
Can anyone tell me if I can use 'sort', 'rename' and 'where' command during the data import stage (in another word during data step)?
I want to:
sort them by Emp_ID; and
rename as Name=Student_name; and
import observations where Student_name<>'';
Here is my initial code that I wrote without any of the above condition.
proc import datafile="E:\data_nonsort.xlsx"
dbms=xlsx replace
out=data_sort (keep = Emp_ID Name);
sheet='test';
run;
Thanks and I much appreciate your help,
You can rename your variable Name by modifying your import procedure like so:
proc import datafile="E:\data_nonsort.xlsx"
dbms=xlsx replace
out=data_sort (rename=(Name=Student_name) keep=Emp_ID Name);
sheet='test';
run;
I believe filtering and sorting will have to be done in a separate sort procedure after you import the file into a SAS data set.
Hope that helps.
You can rename your variable Name by modifying your import procedure like so:
proc import datafile="E:\data_nonsort.xlsx"
dbms=xlsx replace
out=data_sort (rename=(Name=Student_name) keep=Emp_ID Name);
sheet='test';
run;
I believe filtering and sorting will have to be done in a separate sort procedure after you import the file into a SAS data set.
Hope that helps.
Try to use index= option to sort dataset.
proc import datafile="E:\data_nonsort.xlsx"
dbms=xlsx replace
out=data_sort (rename=(Name=Student_name) keep=Emp_ID Name index=(name) where=(age gt 12));
sheet='test';
run;
Xia Keshan
Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.
Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.
Use this tutorial as a handy guide to weigh the pros and cons of these commonly used machine learning algorithms.
Find more tutorials on the SAS Users YouTube channel.