DATA Step, Macro, Functions and more

How to keep SAS from adding "_" (underscore) to field names?

Reply
N/A
Posts: 0

How to keep SAS from adding "_" (underscore) to field names?

I am importing table from Excel.
Field names such as F123, F191, etc
In SAS Data table names appear as "F123", "F191" etc
But when using them, SAS expects names to be "_F1232", "_F191", etc.

How can I set it up to not preceed the name with "_"?

thanks!
Super Contributor
Super Contributor
Posts: 3,174

Re: How to keep SAS from adding "_" (underscore) to field names?

Please share more info about just how you are "importing" your data, and include some specific SAS log (pasted in your post reply) to more accurately explain the SAS problem you are experiencing. It does not make sense that SAS would read up a data column into a SAS variable and not reference the variable as expected. Do remember though that SAS variable names must start with a character.

Below please find a useful Google advanced search argument against the SAS support http://support.sas.com/ website where you may find relative topic information and product documentation:


sas variable names start character site:sas.com

Scott Barry
SBBWorks, Inc.

SAS 9.2 Language Reference: Concepts - Names in the SAS Language
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000998953.htm
N/A
Posts: 0

Re: How to keep SAS from adding "_" (underscore) to field names?

I'm importing using the "Import Data" wizard under the "File" menu option. Standard excel file.
The SAS Data table is created and when I view it, I see my field names (column headers) as "F123", F124", etc

When I do a Proc print, the field names are "_F123" etc.

Here is the log:

NOTE: SAS initialization used:
real time 8.70 seconds
cpu time 1.73 seconds

NOTE: PARTIAL.GLT was successfully created.


1 proc print data =partial.glt;
2 run;

NOTE: There were 1555 observations read from the data set PARTIAL.GLT.
NOTE: PROCEDURE PRINT used (Total process time):
real time 1.09 seconds
cpu time 0.14 seconds
N/A
Posts: 0

Re: How to keep SAS from adding "_" (underscore) to field names?

OK - problem identified - there was a space in front of the field names in excel - and SAS will add the underscore to any illegally named field.
Ask a Question
Discussion stats
  • 3 replies
  • 345 views
  • 0 likes
  • 2 in conversation