07-22-2015 04:02 AM
I want to use a formatting table to map months to quarters. I've created a format table below called "quart". I've included a sample dataset with months but I've included two months outside the range of the format table. However, when I use the code check=put(month,quart.); I still get values for the months outside the range of the format table, specifically, 1 for month 13 and 2 for month 21. Is there a way to change the code so that the code is only executed where the months are in the range of the format table. Something like
if check=put(month,quart.) ne "" then do;
Here is the sample code
input start $2. label $1.;
fmtname = "quart";
type = "c";
proc format cntlin = quart fmtlib;
input month $2.;
07-22-2015 05:09 AM
The field start in the format table quart ranges from 01 to 12 (representing months of the year), the label in the table is the quarter. When I read values from this table in my dataset with "funny" months like 13 and 21, it still returns values.
I would use merges only this is a very simplified example of what I'm doing so merge would appear to be the easier option.
Need further help from the community? Please ask a new question.