BookmarkSubscribeRSS Feed
Static
Calcite | Level 5
Is there a way to directly hit a file thru a proc sql or do I have to first create a data set.

Example

DATA tbs_tmp;
set '/home/xxx/xxx/tbs'
RUN;

then PROC SQL from tbs_temp


or.. is there a way to directly hit the file?

PROC SQL;
CREATE TABLE tbs AS
SELECT * FROM '/home/xxx/xxx/tbs' WHERE etc ORDER BY etc

?? Thanks!
1 REPLY 1
Cynthia_sas
SAS Super FREQ
Hi:
This is not an ODS or Base SAS Reporting procedure (PRINT, REPORT, TABULATE) question.

Proc SQL will NOT read "flat" files directly. So for example, if you have the file /home/xxx/xxx/tbs.txt , then that would be considered an ASCII text file and it is unlikely that PROC SQL would read it. However, IF you had an Oracle table and you used the SAS/Access product for Oracle, then it would be possible for Proc SQL to read the Oracle table. Since you did not show a file extension for your hypothetical file, it is nearly impossible to make any comment about how you might approach a solution. Generally, however, you access "flat files" with an INFILE statement (and then an INPUT statement), not a SET statement in a DATA step program. Then, once the "flat file" has been converted to SAS format, then you could use PROC SQL to accomplish further tasks or perform other reporting.

Your best bet for help is to contact Tech Support. To send a question to Tech Support, go to http://support.sas.com/ and in the left-hand navigation pane, click on the link entitled "Submit a Problem".

cynthia

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 660 views
  • 0 likes
  • 2 in conversation