Question: DATA new_dataset; SET 'P:FA15_DATA'; /* Create I GO SHOPPING FREQUENTLY variable */ IF attitude_code = 6364 THEN shopping_freq = 5; /* AGREE A LOT */
DATA new_dataset; SET 'P:\FA15_DATA'; /* Create I GO SHOPPING FREQUENTLY variable */ IF attitude_code = 6364 THEN shopping_freq = 5; /* AGREE A LOT */ ELSE IF attitude_code = 6407 THEN shopping_freq = 4; /* AGREE A LITTLE */ ELSE IF attitude_code = 6450 THEN shopping_freq = 3; /* ANY AGREE */ ELSE IF attitude_code = 6493 THEN shopping_freq = 3; /* NEITHER AGREE/DISAGREE */ ELSE IF attitude_code = 6536 THEN shopping_freq = 2; /* DISAGREE A LITTLE */ ELSE IF attitude_code = 6579 THEN shopping_freq = 1; /* DISAGREE A LOT */ ELSE shopping_freq = .; /* Missing Value */ LABEL shopping_freq = 'Shopping Frequency'; RUN; PROC FORMAT; VALUE shopping_fmt 1 = 'Disagree A Lot' 2 = 'Disagree A Little' 3 = 'Neither Agree/Disagree' 4 = 'Agree A Little' 5 = 'Agree A Lot'; RUN; PROC PRINT DATA=new_dataset; FORMAT shopping_freq shopping_fmt.; RUN
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
