- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
How do I convert a character field to numeric so I can use it as a measure instead of a category? For example, I have a field called GPA which was pulled into the data source as a category (text field) because even though a GPA is a number, some values for some people have "N/A" in them (for not applicable). That's why it's a text field. I want to use it as a measure so I can add it to a Visual Analytics report and show averages, standard deviations, etc. There are functions in VA that can convert a numeric field to text, but I don't see anything that converts from character to numeric. I can write SQL code with my eyes closed, but I'm fairly new to VA, so I don't know the "tricks" to get around this limitation. Whatever advice you could give would be greatly appreciated.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
WOW, Bruno, this is terrific! All I had to do was plug my field name into the code and it worked perfectly! Thanks so much for the quick reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi
You can use the Parse operator to convert a string to a number like so:
Parse('number_as_text'n, 'COMMA14.')
Create a new calculated data item and use the expression above
Bruno
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
WOW, Bruno, this is terrific! All I had to do was plug my field name into the code and it worked perfectly! Thanks so much for the quick reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Where did you plug in your field name?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
For those that use the Parse function and other string manipulations in SAS Visual Analytics, please note that there may be a performance degradation... http://support.sas.com/kb/57/025.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Michelle
Thanks for pointing this out.
Bruno
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
hi bruno_sas,
could you please help me to convert a measure into category.
I have a variable which falls in Category and contains 1001, 1002, 1003 etc. but when using this variable in calculated item it shows as measure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I already converted that measure as category and its available in Category segmant only but still when using in a filter its coming as measure.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You saved me a lot of time. We meet for a coffee next time you are in Vienna.
Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF
View now: on-demand content for SAS users
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Conversely, how do I treat a measure as a category, i.e. convert the numeric to character, in a data item within an Information Map, for example? Is there an opposite-parse command?
PS: Should I post this as a "new" question?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Please post this as a new questions, since it is not Visual Analytics related.
The proper communitiy would be https://communities.sas.com/t5/SAS-Web-Report-Studio/bd-p/sas_web_report_studio
Bruno