Hi, I am a beginner in SAS. I have a dataset carList that contains a list of cars and their details. I want to create output datasets based on their color, USING MACRO. I cannot make my code work. I was able to create the data sets but the segregation is not working. I would really appreciate if someone could help me. Here's my code, I believe the error is with the 'output' part. I wanted to create an array for the colors using %let but couldn't figure out. (yes, I googled). Thanks in advance!! %let color1 = BLACK; %let color2 = BLUE; %let color3 = BROWN; %let color4 = RED; %let color5 = GRAY; %let color6 = SILVER; %let color7 = WHITE; %let color8 = YELLOW; %let colorData1 = BLACK_Vehicles_try; %let colorData2 = BLUE_Vehicles_try; %let colorData3 = BROWN_Vehicles_try; %let colorData4 = RED_Vehicles_try; %let colorData5 = GRAY_Vehicles_try; %let colorData6 = SILVER_Vehicles_try; %let colorData7 = WHITE_Vehicles_try; %let colorData8 = YELLOW_Vehicles_try; data xxxxxx.carList; length make $ 10; infile '/home/xxxxxx/carList.txt' dlm=','; input make $ name $ type $ color $ year price; run; %macro createm; %do i=1 %to 3; data xxxxxx.&&colorData&i; set xxxxxx.carlist; %do i=1 %to 3; %if color = &&ccolor&i %then %output xxxxxx.&&colorData&i; %end; run; %end; %mend; %createm;
... View more