BookmarkSubscribeRSS Feed
Andalusia
Obsidian | Level 7

I have the following dataset:

data have;
infile datalines truncover;
input type $ quarter phase colors $ creation_date :yymmdd6.;
format creation_date yymmdd6.;
datalines;
K-11 201904 1 blue 20200101
K-11 202001 1 blue 20200101
K-11 202002 2 blue 20200101
K-11 202003 3 blue 20200101
K-11 202004 3 black 20200101
K-11 202101 1 blue 20200101
K-11 202102 2 blue 20200101
K-11 202103 3 blue 20200101
;

I want the column `colors` to be converted to a numeric value so I can use it as a measurement inside a crosstab in SAS Visual Analytics. How can this be done easily?

4 REPLIES 4
Andalusia
Obsidian | Level 7
What do you mean?
Patrick
Opal | Level 21

I'm not very experienced with VA reporting but even so I feel you will need to explain a bit more why you can't use color as a categorical variable. Show us a "mock-up" of the report you want to create using your sample data.

Do you just need counts by category "color"? Or what is this about?

ballardw
Super User

"Blue" does not have an automatic numeric value associated with it. So you would have to provide exactly what number you expect for "blue" or "black" or any other color.

 

Also perhaps if you describe how the number for "blue" will be used we can give you some pointers.

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 994 views
  • 0 likes
  • 4 in conversation