/* Create the dataset APPENDED */ data APPENDED; input textstring $50.; datalines; apples-red red-apples grapes-green blueberries-blue ; run; /* Process the dataset to split and sort the words */ data APPENDED; set APPENDED; /* Split the text string into two words at the hyphen */ word1 = scan(textstring, 1, '-'); word2 = scan(textstring, 2, '-'); /* Sort the words into alphabetical order */ call sortc(word1, word2); /* Combine the words back into one string */ newtextstring = catx('-', word1, word2); run; /* First PROC FREQ on original textstring */ proc freq data=APPENDED; tables textstring / nocum nopercent; run; /* Second PROC FREQ on the new textstring */ proc freq data=APPENDED; tables newtextstring / nocum nopercent; run;
... View more