Exploring, modeling, 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
Super User
Posts: 1,209

Re: how to Concatenate Character and Variable

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
Esteemed Advisor
Esteemed Advisor
Posts: 6,726

Re: how to Concatenate Character and Variable

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));

 

Super User
Posts: 1,209

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
Super User
Posts: 1,209

Re: how to Concatenate Character and Variable

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

Thanks

 

Super User
Posts: 1,209

Re: how to Concatenate Character and Variable

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

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

 

 

Attachment
Post a Question
Discussion Stats
  • 6 replies
  • 383 views
  • 1 like
  • 4 in conversation