Hi,
I want to know if it's possible to rename a variable with a function.
In particular I need to rename 32 variables with the days past from the today's date. Ex: var1=now(), var2=now()-2 etc.
Thanks for your help.
Try:
rename (or label?) VAR1 to %sysfunc(today(),date9.)
rename (or label?) VAR2 to %sysfunc(putn(%eval(%sysfunc(today())-1),date9.))
rename (or label?) VAR3 to %sysfunc(putn(%eval(%sysfunc(today())-2),date9.))
etc
Why do you want to rename a large number of variables in SAS VA? If you do that you will break any VA reports that use the old variable names. Perhaps if you explain what you are trying to do there might be a better way, possibly by creating calculated items.
Thanks for your answer.
I have to realize a report like the one attached.
I have two buttons that filter yellow columns by 2 variables for the right character variable.
I can't use a cross table because my measures are not numerical.
So I've decided to create a list table with 30 categorical variables (DATE1-DATE30, number of day that I need) that have value:
DATE1:
IF ( 'BUTTON 'p = 'VAR 1' )
RETURN 'VAR1_DATE1'n
ELSE 'VAR2_DATE1'n
DATE2:
IF ( 'BUTTON 'p = 'VAR 2' )
RETURN 'VAR1_DATE2'n
ELSE 'VAR2_DATE2'n
etc...
But now I want to show in the table the current date as label in the list table, and rename date1=now(), date2=now()-1 etc, but I don't know what code use and where use it.
thanks for your help.
Where canI insert that code in VA?
Oh this is not good. I swear there was a way to do this. It's been years since I last used VA. What if you create a computed value? Does the macro language get solved?
No, the macro language dosen't get solved in a computed value.
I don't know how to do that!
@Davidsas111 - It would help if you provided a few example rows of your source data. There are probably better ways of transforming your data but since we don't know what it looks like to start with we can't provide any guidance.
Also how often do you refresh the data?
I have to refresh datas every day.
I have to transpose a table with "var" char variables, so I can't do it on VA because cross tables can be applied fornumeric variables.
I transpose it on DI but on VA two bottons have to filters data.
Now I have to Rename the category (calculated as I wrote up) with dates.
How can I do it?
Or how can I transpose in VA character variables in a cross table?
Thanks for your help!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: