Using an Excel file to stock changing parameters for a SAS program -


i have sas program simulates tax system of country, lines like:

if         0<income<bound1          tax = rate1 * income; else if    bound1<income<bound2     tax = rate2 * income; 

and on...

my concern want use program different years, , parameters change on time, @ least because of inflation, fiscal changes. therefore, parameters bound_1, rate_1 , on, in excel file can modify each year more sas program.

searching that, find results on how read datasets excel or how export procedures in excel, not want.

to more precise, have excel file, "x:/taxsystem.xls", , like

if 0<income<"celle1"     tax = "cellf1" * income; else if    "celle1"<income<"celle1"     tax = "cellf2" * income; 

so change cells, more sustainable , prevent forgetting change 1 value

i worked on similar project , after trying few different approaches, 1 settled on seeming least prone unpleasant surprises went this:

  • set workbook relevant excel table isolated on 1 sheet;
  • create vba macro exports sheet new workbook , saves .csv or .txt, , closes it;
  • program sas import .csv or .txt file created.
  • if desired, can add code sas delete .csv or .txt file once it's imported.

i approach because forces process though clean , understandable flat-file bottleneck. limits ways excel can ruin day.

if want integrate it, can set vba macro execute sas program end user has make 1 click set whole thing off.


Comments