BookmarkSubscribeRSS Feed
tessa3
Calcite | Level 5

Please help me!! I am a beginner student to SAS and need help with running a graph. Every time I try it says there's no columns in my dependent variable section. I will attach the code that I get when I upload my .csv file into SAS. 

14 REPLIES 14
PaigeMiller
Diamond | Level 26

We prefer to see code that is pasted as text into your message, not as an attachment, by clicking on the running man icon first and then doing the paste as text into the window that appears. Thank you in advance for complying.

--
Paige Miller
tessa3
Calcite | Level 5

/* Generated Code (IMPORT) */ /* Source File: Accidental_Drug_Related_Deaths_2012-2018.csv */ /* Source Path: /home/u49089211 */ /* Code generated on: 7/11/20, 12:16 PM */ %web_drop_table(WORK.IMPORT2); FILENAME REFFILE '/home/u49089211/Accidental_Drug_Related_Deaths_2012-2018.csv'; PROC IMPORT DATAFILE=REFFILE DBMS=CSV OUT=WORK.IMPORT2; GETNAMES=YES; RUN; PROC CONTENTS DATA=WORK.IMPORT2; RUN; %web_open_table(WORK.IMPORT2);

tessa3
Calcite | Level 5
/* Generated Code (IMPORT) */
/* Source File: Accidental_Drug_Related_Deaths_2012-2018.csv */
/* Source Path: /home/u49089211 */
/* Code generated on: 7/11/20, 12:16 PM */

%web_drop_table(WORK.IMPORT2);


FILENAME REFFILE '/home/u49089211/Accidental_Drug_Related_Deaths_2012-2018.csv';

PROC IMPORT DATAFILE=REFFILE
DBMS=CSV
OUT=WORK.IMPORT2;
GETNAMES=YES;
RUN;

PROC CONTENTS DATA=WORK.IMPORT2; RUN;


%web_open_table(WORK.IMPORT2);

 

PaigeMiller
Diamond | Level 26

Okay, that's the code, thank you. But I don't see how the code relates in any way to your original message or your title.

--
Paige Miller
tessa3
Calcite | Level 5

I'm not sure either, I just thought there was something I could change in my code to be able to have columns in my dependent variable when creating a graph. I think the problem is that my data shows "$" in front of the numbers and I'm not sure how to remove all of them. 

PaigeMiller
Diamond | Level 26

But at no point does your code create a graph. Your code and your explanation needs to connect, and they do not.

 

And we can't see your data, either. Can you show us a portion of the data?

--
Paige Miller
tessa3
Calcite | Level 5

I'm not able to create a graph because there's no numeric variables showing when I go to create a graph. 

Here is my input data:

 

input

 178                        ID  $

 179                        Date  $

 180                        DateType  $

 181                        Age  $

 182                        Sex  $

 183                        Race  $

 184                        ResidenceCity  $

 185                        ResidenceCounty  $

 186                        ResidenceState  $

 187                        DeathCity  $

 188                        DeathCounty  $

 189                        Location  $

 190                        LocationifOther  $

 191                       DescriptionofInjury  $

 192                        InjuryPlace  $

 193                        InjuryCity  $

 194                        InjuryCounty  $

 195                        InjuryState  $

 196                        COD  $

 197                        OtherSignifican  $

 198                        Heroin $

 199                        Cocaine  $

 200                        Fentanyl  $

 201                        FentanylAnalogue  $

 202                        Oxycodone  $

 203                        Oxymorphone  $

 204                        Ethanol  $

 205                        Hydrocodone  $

 206                        Benzodiazepine  $

 207                        Methadone  $

 208                        Amphet  $

 209                        Tramad  $

 210                        Morphine_NotHeroin  $

 211                        Hydromorphone  $

 212                        Other  $

 213                        OpiateNOS  $

 214                        AnyOpioid  $

 215                        MannerofDeath  $

 216                        DeathCityGeo  $

 217            ;

 218            if _ERROR_ then call symputx('_EFIERR_',1);  /* set ERROR detection macro variable */

 219            run;

 

PaigeMiller
Diamond | Level 26

Show us a portion of the data. Attach a small portion (say 10 lines) of .csv file

--
Paige Miller
PaigeMiller
Diamond | Level 26

As far as I can see, your .csv file has no numeric variables in it. The data is not what you apparently expect it to be.

--
Paige Miller
tessa3
Calcite | Level 5

Could age not be used as a numeric variable?

PaigeMiller
Diamond | Level 26

Possibly.

 

But the .csv file is either malformed, or does not contain what you think it contains. Or both.

--
Paige Miller
tessa3
Calcite | Level 5

Okay, thank you for your help. I guess I will not be able to use this data for creating any graphs. 

ballardw
Super User

Some lines from the data file as requested (not attached)

ID,Date,Age,Sex,Race,Location,LocationifOther,DescriptionofInjury,InjuryPlace,InjuryCity,COD,OtherSignifican,Heroin,Cocaine,Fentanyl,FentanylAnalogue,Oxycodone,Oxymorphone,Ethanol,Hydrocodone,Benzodiazepine,Methadone,Amphet,Tramad,Morphine_NotHeroin,Hydromorphone,Other,OpiateNOS,AnyOpioid,MannerofDeath,DeathCityGeo,ResidenceCityGeo,InjuryCityGeo
14-0273,6/28/14 0:00,,,,,,substance,,,"Acute fent, hydrocod, benzodiazepine",,,,Y,,,,,Y,Y,,,,,,,,,Accident,"CT
(41.575155, -72.738288)","CT
(41.575155, -72.738288)","CT
(41.575155, -72.738288)"
13-0102,3/21/13 0:00,48,Male,Black,Hospital,,,,,Cocaine Intoxication,,,Y,,,,,,,,,,,,,,,,Accident,"Norwalk, CT
(41.11805, -73.412906)","NORWALK, CT
(41.11805, -73.412906)","CT
(41.575155, -72.738288)"
16-0165,3/13/16 0:00,30,Female,White,Hospital,,Substance Abuse,Unknown,UNKNOWN,Acute Heroin and Cocaine Intoxication,,Y,Y,,,,,,,,,,,,,,,Y,Accident,"Danbury, CT
(41.393666, -73.451539)","SANDY HOOK, CT
(41.419998, -73.282501)",

This file has all the earmarks of having been entered in Excel with the Alt-Enter to create vertical breaks inside a cell. Note that starting on the the third line the first values is likely not an id and the second is not a date in any way shape or form.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 14 replies
  • 2133 views
  • 0 likes
  • 3 in conversation