Saturday, April 23, 2016

How To Read Variable Length String Correctly In SAS


data oc;
infile "&file_dir./orb_air_clk_2016.csv" dlm=',' firstobs=2;
input local_date $10. mktg_code : $100. ref_id : $50. clicks spend;
run;


The : (colon) format modifier enables you to use list input but also to specify an informat after a variable name, whether character or numeric. SAS reads until it encounters a blank column, the defined length of the variable (character only), or the end of the data line, whichever comes first.

No comments:

Post a Comment