I work with at form thats use dynamic sas in a front end excel solution. When tagattr formula i used with a if clause excel puts #Navn (danish) #NA in a correct code. See code exampel. If use of F2 without any changed correct formula has been used.
The code is in danish because we use excel2016 in danish - and because autotranslation in xml with excel function length or upper return error i xml to excel.
The english is [tagattr="format:#,##0 formula:if(length(RC[-4])>0,RC[-2]*RC[-3],0)"] ;
Full danish code with tabulate= ; (danish excel syntax) gives error. It doesn't matter if tagattr is written in define or compute.
The full code i want to use is tagattr="formula:hvis(længde(RC[-1])>0,j5*(Satser!B4/100),0)" so that the user make input (here cell=j5) and return the right values. "Sater!b4" is a reference to another worksheet. The code is correct, but in excel is #Navn/#NA shown.
How can i show the results in var=testhvis with out the #Navn error?
ods excel file="&udadhoc.\test_tagattr.xlsx";
proc report data=sashelp.class out=testcase ;
column sex height weight testudenhvis testhvis ;
define sex / group;
define height / analysis sum;
define weight / analysis sum;
define testudenhvis / computed style(column)=[tagattr="format:#,##0 formula:RC[-1]*RC[-2]"] ;
define testhvis / computed style(column)=[tagattr="format:#,##0 formula:hvis(længde(RC[-4])>0,RC[-2]*RC[-3],0)"] ;
rbreak after / summarize ;
run;
ods excel close;
Sex | Height | Weight | testudenhvis | testhvis |
F | 545,3 | 811 | 442.238 | #NAVN? |
M | 639,1 | 1089,5 | 696.299 | #NAVN? |
1184,4 | 1900,5 | 2.250.952 | #NAVN? |
Are you saying the Excel is expecting you use that Danish word with the non 7bit ASCII character instead of the English word LENGTH() as the name of the function?
That is probably the cause I seem to remember seeing other places where SAS had trouble dealing with transcoding non 7bit ASCII characters.
Is there some other EXCEL function that does not use non 7bit ASCII characters you could use instead?
Hey,
Yes -that seem's to be the problem. Simpel change to if(len(...... is the solution (thanks Per)
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.