BookmarkSubscribeRSS Feed
draroda
Fluorite | Level 6

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.

4 REPLIES 4
ballardw
Super User

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
Super User
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
ballardw
Super User

@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.

ChrisHemedinger
Community Manager

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;
Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 1340 views
  • 2 likes
  • 4 in conversation