BookmarkSubscribeRSS Feed
DavidPhillips2
Rhodochrosite | Level 12

I am trying to change the value type from numeric to character in Visual Analytics Prepare data tool.  When I try to run the results

If I just change the type to character() the column shows up as a measure.

If I set a character format, I receive ERROR: Number expression requires a numeric format.

6 REPLIES 6
Reeza
Super User

There's a function called 'Treat.AS' or something along those lines and that allows you to convert the type.

DavidPhillips2
Rhodochrosite | Level 12

Can I use this function in the graphical interrface?

Reeza
Super User

Where you drag and drop the formula's to create them? Yes, it needs to be nested inside the main function. 

 

This post has some pictures, if that helps:

https://communities.sas.com/t5/SAS-Communities-Library/3-FAQs-on-date-calculations-in-SAS-Visual-Ana...

IkeEisenhauer
Calcite | Level 5

They asked about Data Preparation tool. TreatAs does not work there, it won't pass validation. TreatAs is only available in Report Designer. You have to manually use INPUT

IkeEisenhauer
Calcite | Level 5

The trick is in the Expression section, use the INPUT function. It is not shown on the drop down of available functions, but if you type it in will work and it will pass validation. As well as not require you to unlock the code.

Parse and TreatAs are NOT available in the Data Preparation tool, those functions only work in Report Designer.

CarolynSch
Calcite | Level 5

I have a numeric field that I want to display as a 7 character field and this worked for formatting directly in SAS Visual Analytics:  (in text field of calculated item): 

Format('Variable Name'n[Raw], 'Z7.')

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
  • 6 replies
  • 6460 views
  • 2 likes
  • 4 in conversation