Changing the Case of All Character Variables in a Data Set
January 25, 2021
1 min
This program will change the case for all of the character variables in a SAS data set. The key here is using the CHARACTER keyword in the ARRAY statement. This will create an array of all the character variables in the dataset.
Once the array is created, you can apply any character functions on all of the character variables.
data cars;set sashelp.cars;array Chars _character_;do i=1 to dim(Chars);Chars=upcase(Chars);end;drop i;run;title "Listing the First 10 Observations in the Cars dataset";proc print data=cars(obs=10 keep=_character_) noobs;run;```**"Output":**![Image]()export const _frontmatter = {"title":"Changing the Case of All Character Variables in a Data Set","slug":"changing-the-case-of-all-character-variables-in-a-data-set","date":"2021-01-25T12:15:15","modified":"2022-02-10T09:41:31","excerpt":"This program will change the case for all of the character variables in a SAS data set. The key here is using the _CHARACTER_ keyword in the ARRAY statement. This will create an array of all the character variables in the dataset.","author":"Subhro","authorSlug":"subhroster","categories":["SAS PROGRAMS"],"tags":[],"wordpressId":8487,"wordpressLink":"https://www.9to5sas.com/changing-the-case-of-all-character-variables-in-a-data-set/","featuredImage":8488,"type":"post"}