Hi All,
I have around 25 datasets ready and from each dataset ,there is one variable which i need to present in Propcase.
At moment, I can not update datasets.
Is there any option in proc report for ods tagset excelxp to convert values in propcase ?
Thanks in advance.
Make a data set from the one you have and apply the propcase function. Use that one for the report.
If that isn't acceptable then you will have to go back to who ever is wanting the text in propcase and have them update the data set.
You also want to check the results. Some things like proper names do not always come out as needed. Smith and Sons as a company name for example would be: Smith And Sons. Names such as MacDonald, O'Hara are also going to be Macdonald and O'hara.
@Reeza wrote:
Create a custom format using a function. An example here with numeric variables but it can be extended to character variables I believe.
https://communities.sas.com/t5/SAS-Programming/Format-a-numeric-WITHOUT-rounding/m-p/492725
Yes the custom formats with Proc FCMP will work with character values after getting the parameters correct to indicate a character value is passed in.
But there is still the potential issue with not-quite-as-desired results from propcase. If there are a smallish number of exceptions you could do a Select/when block or a bunch of if/then/else to correct them. But their is still a potential for a lot of fixes needed.
Great ideas from @ballardw and @Reeza. I think you could also create DATA step VIEWS (or PROC SQL VIEWS) that pass through the original table records, but add one additional field with the propcase transformation.
Such views might be expensive to access multiple times (as each access will pass through the original data), but as a final step before building a report, it might be okay.
data carsReport / view=carsReport;
set sashelp.cars;
propModel = propcase(model);
run;
proc print data=carsReport (obs=10);
var make propModel model;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.