filename mydata "c:\mydata\scores.dat";
data test; infile mydata; input name $ score; run;
filename wild 'wild*.dat'; data; infile wild; input; run;The following example reads all files in the current working directory:
filename allfiles '*.*'; data; infile allfiles; input; run;
C:\MYDATA\TEST.DAT, you can use the following SET option in your SAS configuration file: -set myvar c:\mydata\test.dat
data mytest; infile myvar; input name $ score; run;
SET MYVAR=C:\MYDATA\TEST.BAT. You can also define SET commands by using System Properties dialog box that you access from the Control Panel.
C:\SAS\MYDATA,
you can issue the following FILENAME statement to assign the fileref
JAN to this directory: filename jan "c:\sas\mydata";
data westsale;
infile jan(west);
input name $ 1-16 sales 18-25
comiss 27-34;
run;
data eastsale;
infile jan(east);
input name $ 1-16 sales 18-25
comiss 27-34;
run;|
SAS Command or Statement
|
SAS Window
|
File Extension
|
|---|---|---|
|
FILE statement
|
EDITOR
|
.DAT
|
|
%INCLUDE statement
|
EDITOR
|
.SAS
|
|
INFILE statement
|
EDITOR
|
.DAT
|
|
FILE command
|
EDITOR
|
.SAS
|
|
FILE command
|
LOG
|
.LOG
|
|
FILE command
|
OUTPUT
|
.LST
|
|
FILE command
|
NOTEPAD
|
none
|
|
INCLUDE command
|
EDITOR
|
.SAS
|
|
INCLUDE command
|
NOTEPAD
|
none
|
C:\PROGRAMS\TESTPGM.SAS to
SAS: filename test "c:\programs"; %include test(testpgm);SAS searches for a filename TESTPGM.SAS in the directory C:\PROGRAMS.
filename test "c:\programs"; %include test(testpgm.xyz);
filename test "c:\programs";
%include test("testpgm");filename test "c:\mysasdir";
C:\MYSASDIR\PGM1.DAT for
output: file test(pgm1);
C:\MYSASDIR\PGM1.DAT for
input: infile test(pgm1);
C:\MYSASDIR\PGM1:
%include test("pgm1");\PROGRAMS\PGM1.SAS:
%include programs(pgm1);
\PROGRAMS\TESTPGM.DAT:
file programs(testpgm);
filename progs ("c:\sas\programs",
"d:\myprogs");progs(member1)
filename allsas ("one.sas",
"two.sas", "three.sas");filename alldata ("test1.dat"
"test2.dat" "test3.dat");filename allinc "test*.sas";%include allsas;infile alldata;include allinc;libname abc "My
data file";filename myfile "Bernie's
file";filename summer ("June
sales" "July sales" "August sales");include "A really,
really big SAS program";include "\\zaphod\universe\galaxy\stars.sas";
filename _all_ list;
filename test ("c:\samples","c:\testpgms");
data sampdat;
infile test(phone.dat);
input name $ phonenum $ city $ state $;
run;filename test ("c:\sas","d:\mysasdir");file test(source.pgm);
filename mydata ("qtr1.sas","qtr2.sas",
"qtr3.sas","qtr4.sas");
%include mydata;filename indata "dogdat.dat";
filename outdata ("mydat1.dat","mydat2.dat",
"mydat3.dat","mydat4.dat");
data _null_;
infile indata;
input name breed color;
file outdata;
put name= breed= color=;
run;%include "c:\mydir\oranges.sas";
%include "oranges.sas";
%include oranges;