Remove space from columns while importing in SAS

2019-02-26 12:20发布

问题:

I have a CSV file which i want to import in SAS but the column name of CSV have blank space. For example one of the column is 'country code'. I want to remove remove space and put '_' in that place so that column name becomes Country_Code. Any help..how i can do it using SAS Code.

回答1:

If it's a CSV (comma delimited), then you shouldn't have any problems here. PROC IMPORT ought to import the file and change the name for you. It will label the variable including the space, but it should make the change. (Verify this in SAS Display Manager by opening the dataset and selecting View-> Column Names).

If it's not, then you might try (before the proc) adding options validvarname=v7;. If the setting is currently any, then technically the name with the space is a valid name; it may pass PROC IMPORT's checks. If you're using Enterprise Guide, this setting is any by default.



标签: csv sas