Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Custom sorting for SAS VA

Reply
Learner
Posts: 1

Custom sorting for SAS VA

I have a variable that represents responses to several surveys. There are over 200 unique responses, 60 of which are ordinal responses with a total n of 1,757 responses. For example, in one group of responses I have 'very difficult', difficult', easy' , and 'too easy' whereas, another group of responses may be ' yes', 'no', or 'not sure'. I need those responses sorted in that order. The vast majority of responses, however, are open-ended questions and they do not have to be sorted but I need them to appear in the same table as the sorted ordinal responses.

 

The "Custom Sort" feature in SAS Visual Analytics only allows a limited number of responses and will not even allow me to sort all of my ordinal responses. I created a user-defined format in SAS Enterprise Guide (sample of code shown below) and this allows me to sort the ordinal responses. However, I cannot display the ordinal responses and the open-ended questions in the same table on SAS Visual Analytics, and be able to sort the ordinal responses. Giving a unique value to each open-ended response would be too time consuming. 

 

*sample of user-defined format; 
else if answerup = 'VERY UNLIKELY' then answer_code = 25;
else if answerup = 'UNLIKELY' then answer_code = 26;
else if answerup = 'POSSIBLY' then answer_code = 27;
else if answerup = 'LIKELY' then answer_code = 28;
else if answerup = 'VERY LIKELY' then answer_code =29;

 

else if answerup = '1 NOT CONFIDENT' then answer_code = 30;
else if answerup = '2 SOMEWHAT UNCONFIDENT' then answer_code =31;
else if answerup = '3 SOMEWHAT CONFIDENT' then answer_code = 32;
else if answerup = '4 CONFIDENT' then answer_code = 33;
else if answerup = '5 VERY CONFIDENT' then answer_code = 34;

 

....

* proc format step;


proc format library=formats;
value abe_answern

 

25='Very Unlikely'
26='Unlikely'
27='Possibly'
28='Likely'
29='Very Likely'

30='Not Confident'
31='Somewhat Unconfident'
32='Somwhat Confident'
33='Confident'
34='Very Confident'

 

data lib.survey;
set lib.survey;
format answer_code abe_answern.;

run;

 

 

forum sample.JPG

 

Notice how the responses in "Frequency of Use"  and "One helpful thing learned" are alphabetical. I want the "Frequency of Use" to be sorted as 'Rarely' 'Sometimes' 'Often' 'Always' and "One helpful thing learned" to be sorted alphabetically.

 

Is this possible and how?

 

 

Valued Guide
Posts: 596

Re: Custom sorting for SAS VA

I'm not a SAS VA guru by any means but you should be able to enter some custom code which will do the job for you. I wrote an article not long ago on Custom Sorting with Proc SQL which you can use to derive any order you choose. You can find it here -> https://communities.sas.com/t5/SAS-Communities-Library/Custom-Sorting-with-Proc-SQL/ta-p/373460

Ask a Question
Discussion stats
  • 1 reply
  • 84 views
  • 0 likes
  • 2 in conversation