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

how to Concatenate Character and Variable

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 9
Accepted Solution

how to Concatenate Character and Variable

HI, 

 

I have recently been introduced to SAS VA and using version 7.3

 

I have a client requirement to add a text box where i would input something like "sales for this quarter" & Variable Sales  ..

 

would look something like "sales for this quarter $100000"

 

I have tried to find a way but not able to. Can anyone help me on this please ?  


Accepted Solutions
Solution
‎01-19-2017 04:01 AM
Trusted Advisor
Posts: 1,406

Re: how to Concatenate Character and Variable

Posted in reply to Phoenix232

Hi,

 

The traditional base SAS concatenation is not possible in a standard text box within SAS VA 7.3

 

There is a workaround that has been described in using a button bar that you may find a good work around at https://communities.sas.com/t5/SAS-Communities-Library/SAS-Visual-Analytics-trick-Use-a-button-bar-a...

 

Kind Regards,

Michelle

View solution in original post


All Replies
Super User
Super User
Posts: 9,829

Re: how to Concatenate Character and Variable

Posted in reply to Phoenix232

This is called concatenation.  There are many ways to do this:

||   - to bars means concatenate, this is the basic methid.

cat() - is a function to concate strings, pretty much the same as ||, but you can put in many strings

catx() - is a function to concactenate strings with a delimter between

cats() - is a function to concactenate strings removing whitespace.

Plus many others. look at the documentation as its a basic functionality.  So your problem can be:

result=cat"sales for this quarter",put(variable_sales,dollar10.2));

 

Trusted Advisor
Posts: 1,406

Re: how to Concatenate Character and Variable

@RW9 - FYI, the cat family functions are not available within SAS VA 7.3 or early.

Solution
‎01-19-2017 04:01 AM
Trusted Advisor
Posts: 1,406

Re: how to Concatenate Character and Variable

Posted in reply to Phoenix232

Hi,

 

The traditional base SAS concatenation is not possible in a standard text box within SAS VA 7.3

 

There is a workaround that has been described in using a button bar that you may find a good work around at https://communities.sas.com/t5/SAS-Communities-Library/SAS-Visual-Analytics-trick-Use-a-button-bar-a...

 

Kind Regards,

Michelle

Occasional Contributor
Posts: 9

Re: how to Concatenate Character and Variable

Posted in reply to MichelleHomes

Thanks

 

Trusted Advisor
Posts: 1,406

Re: how to Concatenate Character and Variable

Posted in reply to Phoenix232

My pleasure @Phoenix232 and I understand the workaround is not ideal... Development are aware of this popular requirement and I believe are working on it for a future release. See https://communities.sas.com/t5/SAS-Visual-Analytics/Dynamic-Text-Input-based-on-Drop-Down/m-p/273118...

 

Thanks for marking the response solved.

 

Kind Regards,

Michelle

Learner
Posts: 1

Re: how to Concatenate Character and Variable

Posted in reply to Phoenix232

Hi Phoenix

 

The basic rule is "allways format as the type of variable, that you need to deal with". 

IE: If you need to add or subtract days from a date; convert the date to a number (using the operator "TreatAs"), then do the maths, and wrap the entire formula in a new "TreatAs" to convert back to date-format.

 

Same thing with numeric values: Use "Format" and "Best" as operator to convert from numeric to string. Concatenate the two and you are done!

 

I've added a matrix showing which operators to use in VA 7.3, if you wish to convert between variable types.

 

Best regards

 

Jais

 

 


Convert matrix.png
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 24113 views
  • 2 likes
  • 4 in conversation