Showing posts with label filename. Show all posts
Showing posts with label filename. Show all posts

Thursday, June 14, 2012

function fileexist to determine a file exist or not

in linux, the filename is case sensitive and remember to add surfix .

data a;
a=fileexist("/data02/temp/temp_hsong/seo/seo_expr/seo_visitnew_raw_incr.sas7bdat");
run;

proc print data=a;
run;


Obs a

1 1

Monday, March 12, 2012

use SAS to read data from website: use filename url

a sample sas code:



filename testdata url "http://dl.dropbox.com/u/10684315/sas_pub/sas_read_webdata.csv";

data test;
  infile testdata dsd firstobs=2;
  length CANONICAL_KEYWORD $400.;
  input keyword_id CANONICAL_KEYWORD $ node_id rank;
run;

data test;
  set test;
  canonical_keyword=translate(canonical_keyword,' ','"');
  canonical_keyword=trim(left(canonical_keyword));
run;

proc contents data=test;
run;

proc print data=test width=min;
run;


An example code from SAS help:



filename foo url 
    'http://support.sas.com/techsup/service_intro.html';
       
data _null_;
   infile foo length=len;
   input record $varying200. len;
   put record $varying200. len;
   if _n_=15 then stop;
run;