Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Arrays, Import ,Characters!?

Status
Not open for further replies.

hcs301080

Programmer
Jun 5, 2003
3
US
Hi!,

I am using the IMPORT procedure to put the excel file in sasuser.data

Now some of the columns in the file has character values (non-numneric) ...when I try to delete the "." entries in the columns containg the character values using the standard array method.. then it is giving me errors...

data sasuser.data2;
set sasuser.data;
array cc {*}city country;
do i=1 to 2;
if cc{i}=. then delete;
end;
run;


the log file says that it is converting the values to numeric values....

By using the Import procedure ...does SAS automatically detects that the values are numeric or characters??
Or should I use the infile statement and then do the above arry method!

Any suggestions !!

Thanks a lot!!
 
In SAS . means numerical missing value. If you what to delete "." as a character you need to put quotes around it.

if cc{i}= "." then delete;

There is no need to use array. This is equivalent to what you have above and more efficient:

data sasuser.data2;
set sasuser.data;
where city ^= "." and country ^= ".";
run;
 
I have seen problems occur on importing excel files when the first observation of data for a column was missing. Then the formating was not always the best. A good solid block of data with variable names listed above will result in the successful import of data. Blank rows may be a problem.


Not sure this helps but...dje
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top