导入SAS时从列中删除空间 [英] Remove space from columns while importing in SAS

查看:135
本文介绍了导入SAS时从列中删除空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要导入SAS的CSV文件,但是CSV的列名具有空格.例如,列之一是国家代码".我想删除删除空间,然后在该位置放置"_",以使列名成为Country_Code.任何帮助..我如何使用SAS代码做到这一点.

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.

推荐答案

如果它是CSV(逗号分隔),那么这里应该没有任何问题. PROC IMPORT应该导入文件并为您更改名称.它会标记包含空格的变量,但是应该进行更改. (通过打开数据集并选择视图"->列名",在SAS Display Manager中对此进行验证.)

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

如果不是,那么您可以尝试(在proc之前)添加options validvarname=v7;.如果当前设置为any,则从技术上讲带空格的名称是有效名称;它可能会通过PROC IMPORT的检查.如果您使用的是企业指南,则默认情况下此设置为any.

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.

这篇关于导入SAS时从列中删除空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆