Hello, I am a SAS learner, trying to find a way to break down a hand-written code into series of query builders for more user friendly project. The code is used in the Medical Expenditure Panel Survey workshop and stored in Github website: https://raw.githubusercontent.com/HHS-AHRQ/MEPS/master/SAS/exercise_5a/Exercise5a.sas This is the output: https://github.com/HHS-AHRQ/MEPS/blob/master/SAS/exercise_5a/Exercise5a_OUTPUT.TXT This is the part I'm having trouble with. Please notice there is the use of First.variable and Last.variable to distinct two tables. Is there any way this part can be done in the query builder? The goal is to minimize the need to write codes in a program to get the result. Thank you for help! PROC SORT DATA=CDATA.H181 (KEEP=DUPERSID DUID CPSFAMID FAMWT15C VARSTR VARPSU TOTSLF15 TTLP15X) OUT=PERS; BY DUID CPSFAMID; DATA PERS2 FAM (KEEP=DUID CPSFAMID FAMSIZE FAMOOP FAMINC); SET PERS; BY DUID CPSFAMID; LABEL FAMSIZE = '# OF PERSONS PER CPS FAMILY' FAMOOP = 'TOTAL OUT-OF-POCKET EXP (TOTSLF15) PER CPS FAMILY' FAMINC = 'TOTAL INCOME (TTLP15X) PER CPS FAMILY'; IF FIRST.CPSFAMID THEN DO; FAMSIZE = 0 ; FAMOOP = 0 ; FAMINC = 0 ; END; FAMSIZE + 1 ; FAMOOP + TOTSLF15 ; FAMINC + TTLP15X ; OUTPUT PERS2; IF LAST.CPSFAMID THEN OUTPUT FAM; RUN;
... View more