BookmarkSubscribeRSS Feed
GreggB
Pyrite | Level 9
Can I make this code work somehow? The starred out keep option doesn't work but I want it to. 🙂 I could create a another data step with just these variables but am always looking for more efficient means of doing things.

proc export data=astu_efa_sort /*(keep=(schnum permnum_s last_s first_s middle_s grade_s efaprim engprof_s advisor_s ela_sort math_sort science_sort social_sort))*/
outfile='G:\Departments\Research\TESTING\PASS\2009\TestingRosters\prelim_roster' dbms=excel replace;
run;
7 REPLIES 7
data_null__
Jade | Level 19
With PROC EXPORT the best you can do is to create a VIEW with the subset of variables you want. Should be efficient enough.
Paige
Quartz | Level 8
I have no problems getting proc export to work with a keep statement in SAS 9.2.

your syntax is wrong, there is no parenthesis after keep=, and thus you would also only need a single parenthesis at the end of the keep list
GreggB
Pyrite | Level 9
Thanks. When I removed a set of ( ), it worked, BUT I had to star out the WHERE statement. Should I not be able to to get the WHERE and KEEP statement to work?

option spool;
proc export data=astu_efa_sort /*(where=(schnum='006'))*/

(keep=schnum permnum_s last_s first_s middle_s grade_s efaprim engprof_s advisor_s ela_sort math_sort science_sort social_sort)

outfile='G:\Departments\Research\TESTING\PASS\2010\TestingRosters\prelim_roster.xls'
dbms=excel
replace;
run;
RickM
Fluorite | Level 6
Are you putting the where and keep inside of one parenthesis or two? ie.
(where=(schnum='006') keep=schnum permnum_s last_s first_s middle_s grade_s efaprim engprof_s advisor_s ela_sort math_sort science_sort social_sort)

or
(where=(schnum='006')) (keep=schnum permnum_s last_s first_s middle_s grade_s efaprim engprof_s advisor_s ela_sort math_sort science_sort social_sort)

it is more helpful to see the code when it failed (and preferably in the log) than when things are comented out so it doesn't fail.
GreggB
Pyrite | Level 9
Here is the failed code:

proc export data=astu_efa_sort (where=(schnum='006'))
(keep=schnum permnum_s last_s first_s middle_s grade_s efaprim engprof_s advisor_s ela_sort math_sort science_sort social_sort)
outfile='G:\Departments\Research\TESTING\PASS\2010\TestingRosters\prelim_roster.xls'
dbms=excel
replace;
run;
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Your KEEP= and WHERE= both must be located inside a set of parentheses for the particular dataset being referenced.

Scott Barry
SBBWorks, Inc.
RickM
Fluorite | Level 6
the where and keep options should be inside one set of parenthesis. See the following:

http://support.sas.com/documentation/cdl/en/lrdict/62618/HTML/default/a001000998.htm

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 21959 views
  • 0 likes
  • 5 in conversation