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;
array clean{*} preferred_browser read_news online_shopping online_gaming facebook twitter other_social_network;
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}="Gogle" then clean{i}="Google";
if clean{i}="Yohoo" then clean{i}="Yahoo";
if clean{i}="99" then clean{i}=".";
if clean{i}="Linked In" then clean{i}="LinkedIn";
end;
drop i;
run;
Log is as follows:
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
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
Thank you. That worked!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.