pumsx: PUMS Extraction Web Application ====================================== Specs, 10/7/2003, jgb Purpose: Application lets the user generate an extract from data in the pums2000 data directory. The extract is in the form of a SAS dataset. Optionally, format codes can be assoicated with the variables and a mini-codebook file with the SAS source code used to generate those library formats can be generated as well. Files: The web page is in /pub/websas/(test/)/pumsx.html. The program file is pumsx.sas in the same directory. Parameters: State : Multi-valued parm (from multiple select list). Defaults to "mo". As user selects states the html form generates "state=" parm specs, where is the state postal abbrevation. E.g. we might have: state=mo state=ks state=il Sample : User gets to choose between 1% and 5% sample files. sample=5 is the default. sample=1 is the other possbility. Setout : Name of the generated extract dataset. Defaults to pumsx. Allows the user to specify a more mnemonic name for their output. Nobsout : For trial runs. Limits the number of output observations. After writing this many observations the data step generating the output will execute a stop statement and issue a warning message regarding this back to the browser. Var : Multi-valued parm indicating what variables the user wants to keep on their output. These can be from either the P or the H record, it doesn't matter. (This application will be working with the SAS views that merge the precs and hrecs datasets together.) The weight variables hweight and pweight are automatically added to all extract sets and need not (can not, i.e. they are not on the select menu) be specified. Allocation flag variables will NOT be specified via this parm (i.e. they will not appear on the select menus) -- see Aflag parm, next. The values associated with this parm are the variable names on our SAS datasets. Special values that can be specified are: ALL -- all variables are kept. ALLH -- all variables on the H record are kept. ALLP -- all variables on the P record are kept. Aflags : This is an option (with 1/0 yes/no values) that lets the user specify whether they want to keep allocation flag varibles on their extract. Default value is 0, do NOT keep them. When user checks this option then the program will automatically keep the allocation flag variables associated with the other variables selected. Formats : This is an option (with 1/0 yes/no values) that lets the user specify whether they want to associate value-label format codes with the variables on the output dataset. The default is 1, indicating they do want to use the format codes. Format statements will be generated to implement this. In addition, the SAS source code for these value-label formats will be generated on a file named formats.sas that will be included in the user output directory. (This allows users at other sites to easily load these formats on their platforms. It also comes in very handy as a mini codebook file, customized with just those variables you'll be using for this application. (This can be implemented using the proc format cntlout option or we could select lines of code from the valfmats.sas module in the pums2000/Tools directory. We'll need to include code for the pictca format code as well since many of the others reference it. ) PUMA : Multi-valued parm indicating that user wants to filter the data based on the puma code. If sample=5 then this is assumed to be the 5% PUMA code, not the "super-puma". Values are of the form ss-ppppp, where ss is the FIPS state code and ppppp is the 5-digit PUMA code. All leading and trailing zeroes are kept. (Note: We should use javascript tools to dynamically alter the select menu for this multi-valued parm based on what states the user selects from an earlier menu on the page.) FILTER : This is a 256-character text input string that can be typed in by the user. It will contain a "filter expression" used to subset the data. It will be parsed and checked to make sure it contains only variable names, parentheses, logical operators and numeric literals (with or without quotes). Parens and quote marks must occur in matching pairs. Thus: (persons ='1' or bldgsz='01') is okay, but x rm *.* is not. The variable names used in the filter code must be ones specified via the vars parm. The var parm values will be used to genreate a dataset keep= option. So, if a variable is not specified (selected from the var multi-select list) then the data step being used to generate the output will never see it. Output: The output will look like that generated by the dexter data extraction utility. It will consist of a dynamic menu page (written to _webout) that will provide links to -a summary log file. Should include a count of households and persons, weighted and unweighted, on the extract file. -a sas source code (.sas) file containing the sas statements used to generate the extract. This is different from the way we do most of our web apps where we just use the macro language to genreate and execute the code. Our approach here is to use put statements to write the generated code ourselves to a file which we will then %include in order to execute it. We want to do it this way because it allows the user to access the extraction code and run it locally (perhaps after editing) if they so choose. Unlike most of our web applications, our expected audience for this application is SAS programmers. -a sas dataset output file -a sas formats file (codebook), if requested.