BookmarkSubscribeRSS Feed
ksachar
Obsidian | Level 7

I am performing data manipulation for VA and I have date valiable in date format.

I calculated month using SAS function in SAS-EG and I got numeric output (1,2,3...). I wanted to have month in Character form (Jan, Feb..etc). So, I used Proc format; value m ;

1='Jan'....;

run;

I am using this in a Line Graph and month is a category variable on X-axis, when I sort, I get the sorting in Alphabetical order Apr being the first

 

I tried little variation in proc format:

1='1:Jan' and when I sort I get this order 1, 11, 12, 2, 3, 4, 

 

Is there any way I can get month in Character form and when I sort I get the actual order in Visual Analytics.

 

Thanks

5 REPLIES 5
Astounding
PROC Star

You're very close with your final variation.  You could try adding a leading zero for months 1-9:

 

value m 1='01:Jan' ......;

 

Or you could use a leading blank:

 

value m 1=' 1:Jan' ......;

 

Again, the leading blank would be for months 1-9 only.

MichelleHomes
Meteorite | Level 14

Use your original date data item in SAS Visual Analytics and simply change the format in the data pane properties panel to a month format and you'll get the ascending month order you desire.

 

Kind Regards,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
ksachar
Obsidian | Level 7

Thanks. One more thing. Is there any way I can find teh Week number in VA. Instead of using a week function in EG?

MichelleHomes
Meteorite | Level 14

There is no week related format available within the Visual Analytics data item properties pane however you can create a calculated item and use the WeekNumber( ) operator on date data item that will return a week number (0-53) for the date.

 

If this has answered your question, please mark the question as solved.

 

Kind Regards,

Michelle

//Contact me to learn how Metacoda software can help keep your SAS platform secure - https://www.metacoda.com
Jun_KP
Calcite | Level 5

In SAS VA under the data selection on the left panel, you can right click the data element and select "New Custom Sort". A window will pop up and you can then put the data value in the order you would like to see in Graph or Table.

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 2850 views
  • 2 likes
  • 4 in conversation