## Array Help: Invalid numeric data

Solved
Occasional Contributor
Posts: 17

# Array Help: Invalid numeric data

I need help figuring out where I've gone wrong, please.

I have a data set containing 29 observations and 12 variables.  After I import my data set, I see the following {below}. I'm attempting to use an array to clean up data. However, once I enter my code, I'm left with 7 variables and 1 observation. I don't know where I am going wrong and would appreciate help.

Thank you.

` `
``````Libname Clean '/folders/myfolders/Week 11';

proc import datafile='/folders/myfolders/Week 11/BAS150 Survey.xlsx'
dbms=xlsx
out=Clean.CleanSurvey;
run;

proc print data=clean.cleansurvey;
run;

proc freq data=clean.cleansurvey;
run;

data clean.cleansurvey;
do i = 1 TO dim(clean);
if clean{i}="Eleven" then clean{i}="11";
if clean{i}=" " then clean{i}=".";
if clean{i}="Fire Fox" then clean{i}="Firefox";
if clean{i}="Yohoo" then clean{i}="Yahoo";
if clean{i}="99" then clean{i}=".";
end;
drop i;
run;``````

Log is as follows:

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
61
62 data clean.cleansurvey;
64 do i = 1 TO dim(clean);
65 if clean{i}="Eleven" then clean{i}="11";
66 if clean{i}=" " then clean{i}=".";
67 if clean{i}="Fire Fox" then clean{i}="Firefox";
69 if clean{i}="Yohoo" then clean{i}="Yahoo";
70 if clean{i}="99" then clean{i}=".";
72 end;
73 drop i;
74 run;

NOTE: Character values have been converted to numeric values at the places given by: (Line)Column).
65:15 65:29 66:15 66:24 67:15 67:31 68:15 68:28 69:15 69:28 70:15 70:25 71:15 71:32
NOTE: Invalid numeric data, 'Eleven' , at line 65 column 15.
NOTE: Invalid numeric data, 'Fire Fox' , at line 67 column 15.
NOTE: Invalid numeric data, 'Gogle' , at line 68 column 15.
NOTE: Invalid numeric data, 'Yohoo' , at line 69 column 15.
NOTE: Invalid numeric data, 'Linked In' , at line 71 column 15.
NOTE: Invalid numeric data, 'Eleven' , at line 65 column 15.
NOTE: Invalid numeric data, 'Fire Fox' , at line 67 column 15.
NOTE: Invalid numeric data, 'Gogle' , at line 68 column 15.
NOTE: Invalid numeric data, 'Yohoo' , at line 69 column 15.
NOTE: Invalid numeric data, 'Linked In' , at line 71 column 15.
NOTE: Invalid numeric data, 'Eleven' , at line 65 column 15.
NOTE: Invalid numeric data, 'Fire Fox' , at line 67 column 15.
NOTE: Invalid numeric data, 'Gogle' , at line 68 column 15.
NOTE: Invalid numeric data, 'Yohoo' , at line 69 column 15.
NOTE: Invalid numeric data, 'Linked In' , at line 71 column 15.
NOTE: Invalid numeric data, 'Eleven' , at line 65 column 15.
NOTE: Invalid numeric data, 'Fire Fox' , at line 67 column 15.
NOTE: Invalid numeric data, 'Gogle' , at line 68 column 15.
NOTE: Invalid numeric data, 'Yohoo' , at line 69 column 15.
NOTE: Invalid numeric data, 'Linked In' , at line 71 column 15.
NOTE: Invalid numeric data, 'Eleven' , at line 65 column 15.
NOTE: Invalid numeric data, 'Fire Fox' , at line 67 column 15.
NOTE: Invalid numeric data, 'Gogle' , at line 68 column 15.
NOTE: Invalid numeric data, 'Yohoo' , at line 69 column 15.
NOTE: Invalid numeric data, 'Linked In' , at line 71 column 15.
NOTE: Invalid numeric data, 'Eleven' , at line 65 column 15.
NOTE: Invalid numeric data, 'Fire Fox' , at line 67 column 15.
NOTE: Invalid numeric data, 'Gogle' , at line 68 column 15.
NOTE: Invalid numeric data, 'Yohoo' , at line 69 column 15.
NOTE: Invalid numeric data, 'Linked In' , at line 71 column 15.
NOTE: Invalid numeric data, 'Eleven' , at line 65 column 15.
NOTE: Invalid numeric data, 'Fire Fox' , at line 67 column 15.
NOTE: Invalid numeric data, 'Gogle' , at line 68 column 15.
NOTE: Invalid numeric data, 'Yohoo' , at line 69 column 15.
NOTE: Invalid numeric data, 'Linked In' , at line 71 column 15.
_N_=1
NOTE: The data set CLEAN.CLEANSURVEY has 1 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

75
76 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
89

Accepted Solutions
Solution
‎03-29-2017 09:16 PM
Super User
Posts: 8,214

## Re: Array Help: Invalid numeric data

I haven't looked closely at your code but, in your final datastep, there is no set statement.

I would think you should have, as your second line, included a statement like:

`set clean.cleansurvey;`

Art, CEO, AnalystFinder.com

All Replies
Solution
‎03-29-2017 09:16 PM
Super User
Posts: 8,214

## Re: Array Help: Invalid numeric data

I haven't looked closely at your code but, in your final datastep, there is no set statement.

I would think you should have, as your second line, included a statement like:

`set clean.cleansurvey;`

Art, CEO, AnalystFinder.com

Occasional Contributor
Posts: 17

## Re: Array Help: Invalid numeric data

Thank you. That worked!

☑ This topic is solved.