开发者

How to import variable names longer than 8 in SAS?

开发者 https://www.devze.com 2023-02-18 13:04 出处:网络
I am usi开发者_运维问答ng SAS 9 to import a CSV file. Some column names have more than 8 characters. When I imported, there was an error saying the columns are illegal in version 6 dataset.

I am usi开发者_运维问答ng SAS 9 to import a CSV file. Some column names have more than 8 characters. When I imported, there was an error saying the columns are illegal in version 6 dataset.

Why SAS says it is a version 6 dataset? Even if I put OPTIONS validvarname=v7; at the beginning, SAS still complains the same thing. I have to name columns with more than 8 characters and it seems a stupid restriction. How can I import such a CSV file? Thanks.


I don't think more than 8 chars should be a problem, can you put _ in place of blanks and check that no column name is a duplicate. Also numbers should go at the end I think (so no 3in4fddfd or so).


There are a few other methods available for importing csv data. If you can save the csv in xls format you could try the following:

libname try EXCEL 'C:\temp\try.xls';

data imported;
    set try.'try$'n;
run;

I think this method allows variable definitions so maybe try specifying the length/format if the variable still causes trouble.

0

精彩评论

暂无评论...
验证码 换一张
取 消