11-04-2015 12:32 PM
Hello everyone, I have a data set with about 900 columns in it. I want to export this data set into access, since access cannot handle more than 255 variables, I want to split the data set into four data sets with less than 255 columns. I was wondering is there a way to select a range of columns in sas? Thanks!
11-04-2015 01:29 PM
You can also select columns using other naming shortcuts:
Select those variables starting with the prefix X
select all numeric or all character variables
Select by naming variables with a common prefix and a numeric suffix
keep month1 - month12;
11-04-2015 03:11 PM
I couldn't help myself.
Here is a macro that will split the data set into a user specified number of data sets.
%macro split(dsn=, dsnroot=fred, splitcnt=3);
%local i j;
proc contents data=&dsn
proc sql noprint;
into :vars1 -
%let vcnt = &sqlobs;
%* Nominal number of variables in each new dataset;
%let cnteach = %sysevalf(&vcnt/&splitcnt,ceil);
%do i = 1 %to &splitcnt;
%do j= %sysfunc(max(1,%eval((&i-1)*&cnteach+1))) %to %sysfunc(min(&vcnt,%eval((&i)*&cnteach)));
%put &=i &=j;
%split(dsn=sashelp.shoes, dsnroot=want, splitcnt=2)
11-05-2015 01:39 PM