BookmarkSubscribeRSS Feed
Rahul_SAS
Quartz | Level 8


Hi Experts,

 

I using variables Sr No, Emp Code as category that contains all numeric values(like 0001-9999 and 40000-70000) so converted before bringing into LASR and its showing under Category also. But when I am using these variable in calculated column or filter expression its coming as Measure.

 

Actually I want parameterise my report search using these variables so using these variable in filter expression with parameter like:

 

(Emp ID) Contains (Parameter Emp ID)

 

but its coming as measure so not able to use Contain function.

 

 

 

Couldn't figure out the problem.

 

Please help.

 

-Rahul

6 REPLIES 6
Rahul_SAS
Quartz | Level 8

Hi Experts,

 

I using variables Sr No, Emp Code as category that contains all numeric values(like 0001-9999 and 40000-70000) so converted before bringing into LASR and its showing under Category also. But when I am using these variable in calculated column or filter expression its coming as Measure.

 

Actually I want parameterise my report search using these variables so using these variable in filter expression with parameter like:

 

(Emp ID) Contains (Parameter Emp ID)

 

but its coming as measure so not able to use Contain function.

 

 

 

Couldn't figure out the problem.

 

Please help.

 

-Rahul

Kiwi_Colin
Fluorite | Level 6

Hi Rahul

 

You'll be pleased to find this is very quick to fix.

 

As you've found, when a numeric variable comes into VA it defaults to being a measure. 

 

If you want it to be a category, you can easily change it to that.

 

Click on the data item in the left pane

> See properties of that data item at the bottom, with "Classification" shown as "Measure"

> Click on "Measure", and select "Category" from drop down

 

Or can "Right-mouse" click on data item in left pane, and choose "Category" 

 

Done! It now can be used as a category. Of course you can't do calcuations on it now.

 

If you need to use it in both ways, that is as "Category" and "Measure", you can duplicate the data item, call it a different name, and change that one to a "Category".

 

A classic for this is age. You may want age as a "Measure", to get average or max age. And also want age as a "Category", to have certain age groups, so can show bars for each age group.

 

Hope that helps,

 

 

Rahul_SAS
Quartz | Level 8

Thank you sooo much kiwi_colin for your prompt reply.

 

I have already used the solution you have mentioned above.

 

The problem persist even after converting that variable into category as I mentioned in my post that its showing in Category segment only.

 

I am not able to use that converted categorical variable as categorical variable its still coming as Measure when I try to use that in a Calculated column or Filter Expression.

 

-thanks

sas_viclearner
Fluorite | Level 6

Hi Colin,

I have a numeric measure "year" and to convert it into category variable "Year" do i need to duplicate the numeric measure and name it with category variable name

MichelleHomes
Meteorite | Level 14

Hi @sas_viclearner,

 

You would only need to duplicate Year if you need to have both a measure type and a category type for your analysis.

 

I've replied to the question you posted at https://communities.sas.com/t5/SAS-Visual-Analytics/convert-numeric-measure-year-to-category-variabl...

 

Kind Regards,

Michelle

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

 

If the same dataset is used in multiple reports, and a certain numeric column is always used as a category, it might be a good idea to give the column a format. That will make the column a category in SASVisualAnalyticsDesigner by default.

 

* Format must be stored where Visual Analytics can find it     ;
libname formats "/opt/sas/config/Lev1/SASApp_VA/SASEnvironment/SASFormats/";

* Generic format that can be used for (m)any numeric variable(s)    ;
proc format library=formats.formats;
    value category
        .="Unknown age";
quit;

* Apply format to variables who are to be used as categories. Can be difficult to achieve in the databuilder.
* Do in dataintegration layer if possible.      ;
proc sql noprint;
    create view TEMP_LASR_VIEW_16353 as 
    SELECT
        CLASS.Name length=8 AS Name,
        CLASS.Sex length=1 AS Sex,
        CLASS.Age format=category. length=8 AS Age,
        CLASS.Height length=8 AS Height,
        CLASS.Weight length=8 AS Weight 
    FROM
        sashelp.CLASS CLASS;
quit;

 

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5960 views
  • 3 likes
  • 5 in conversation