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

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

问题描述

我有一个 CSV 文件,我想将它导入 SAS,但 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 应该为您导入文件并更改名称.它将标记包括空格在内的变量,但它应该进行更改.(通过打开数据集并选择 View-> Column Names 在 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天全站免登陆