Help using Base SAS procedures

sql query

Accepted Solution Solved
Reply
Super Contributor
Super Contributor
Posts: 440
Accepted Solution

sql query

hi,

i am supposed to  run a query such as

proc sql;

create table temp as select var1,var2

from have where var1>0

group by var2;quit;

and copy the results and paste into an excel sheet but when running my program file.sas which has this query i only get the log saying you created a  table of 100 records and 2 variables  but i dont get a file.lst file which would display the data so i can copy it and paste it.

it can not be a  dataset. has to be data i copy from the listing.  how do  i achieve this? anyone pls?


Accepted Solutions
Solution
‎06-15-2016 08:46 AM
Trusted Advisor
Posts: 2,113

Re: sql query

"create able temp" creates a SAS data set. 

 

you can get a several ways:

  • Drop the "create table temp" and PROC SQL will just list the data.
  • Run proc print on "temp" to create the listing.

 

If you have SAS ACCESS licensed, you could directly export "temp" to Excel.

 

 

View solution in original post


All Replies
Solution
‎06-15-2016 08:46 AM
Trusted Advisor
Posts: 2,113

Re: sql query

"create able temp" creates a SAS data set. 

 

you can get a several ways:

  • Drop the "create table temp" and PROC SQL will just list the data.
  • Run proc print on "temp" to create the listing.

 

If you have SAS ACCESS licensed, you could directly export "temp" to Excel.

 

 

Super User
Posts: 5,260

Re: sql query

Or use proc export to avoid the manual copy/paste operation.

Data never sleeps
Super Contributor
Super Contributor
Posts: 440

Re: sql query

Thank you!

Super User
Posts: 17,962

Re: sql query

Copy and pasting is a bad idea, it's too easy to make mistakes.

 

If you can't export to excel due to some license restriction - ie no SAS/Access look into the following macro.

http://www.sascommunity.org/wiki/A_Poor/Rich_SAS_Users_Proc_Export

 

Or export to a CSV, and then save as an Excel file, since you're doing a manual step anyways.

Super Contributor
Super Contributor
Posts: 440

Re: sql query

Thanks Reeza,

I did export  it into an excel file  but they did not want it that way. They have always been copying and pasting the listing. Dont know why.

the max ls(linesize) is 256 right?

I was  trying to shrink the  output a  bit but i guess in SAS thats  the maximum

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 411 views
  • 5 likes
  • 4 in conversation