Hi Everybody! I recently came across acode online that works fantastically well in splitting a big dataset into smaller datasets. However, I was wondering if someone could help me modify it so the smaller datasets are more aligned with what I want. Right now, the code (see below) splits the big dataset based on one variable (a character variable). What I want to do is split the big dataset by two different variables, the current variable in the code but also by a second variable (not currently in code). For example, let's assume I have a dataset for the entire United States for six years (2009-2015). I want to split that dataset per state per year (Texas2012). Here is the code I am using: %LET TABLE=PQIEX.STELIGENROLL_KEYVAR; %LET COLUMN=SDA; PROC SQL NOPRINT; /* build a mini program for each value */ /* create a table with valid chars from data value */ SELECT DISTINCT CAT("SDA.PROFILE_",COMPRESS(&COLUMN.,,'KAD'),"(WHERE=(&COLUMN.=",QUOTE(&COLUMN.),"))") INTO :ALLSTEPS SEPARATED BY '' FROM &TABLE.; QUIT; %PUT NOTE:&ALLSTEPS.; DATA SDA.&ALLSTEPS.; SET &TABLE; RUN; Some additional information that might be helpful: 1) SAS Version 9.2 2) Library name: PQIEX 3) Dataset: STELIGENROLL_KEYVAR 4) First Splitting Variable: SDA (character variable with 13 different values) 5) Second Splitting Variable (the one I am having trouble incorporating into the code): FFYEAR (numeric variable for the years 2009-2015) I am fairly new with SAS and just have no clue how to modify this code in order to split the dataset by two variables. My mind starts getting confused on how to treat the numeric variable and how to incorporate it into the name of the new datasets. If y'all can please help me (and have patience with my ignorance), I would greatly appreciate it! Muchas Gracias
... View more