BookmarkSubscribeRSS Feed
wguo1
Calcite | Level 5

I run the program it come out this:

 

NOTE: The data set WORK.DST1 has 0 observations and 18 variables. what does it mean ? Does it mean ? My data is in csv file .

9 REPLIES 9
Amir
PROC Star

Hi,

 

Observations in SAS are like rows or records of data. The message you are seeing indicates that the SAS data set (table) you have created holds no rows / records.

 

Share your code and a representative sample of the input data that can be read by your code. Also share the log.

 

 

Regards,

Amir.

wguo1
Calcite | Level 5

Hi Amir,

  Thank you for helping me. Sample of data like that:
 
 please see the attached file.

;

Thanks .
 
also, how should  I import data like this. it is a csv file. Thanks.
gamotte
Rhodochrosite | Level 12

You have to describe more precisely your needs.

 

Here are the contents of your csv file :

 

Trial - 2015,,,,,
,,,,,
food  quality data,,,,,
,,,,,
Plot,Cultigen number,Rep,Loc,Std,1
,,,,,
6360,1,1,CIe,6,11
,,,,,
6366,2,1,CIe,6,.

What should the output dataset look like ? What are the names/formats of the columns ?

MadhuKorni
Quartz | Level 8
data FoodQualityData;
infile "path/filename.csv" firstobs = 6 dsd;
input Plot Cultigen number Rep Loc $ Std _1;
run;
wguo1
Calcite | Level 5
HI , I try your code , but it is only read the first line of data which is
empty.

here is the note form the lot:




NOTE: The infile "C:\Users\Guo\Desktop\trail 2015.csv" is:
Filename=C:\Users\Guo\Desktop\trail 2015.csv,
RECFM=V,LRECL=32767,File Size (bytes)=145,
Last Modified=18Jun2018:13:56:50,
Create Time=18Jun2018:13:56:49

NOTE: Invalid data for Plot in line 2 1-5.
NOTE: Invalid data for Cultigennumber in line 3 1-20.
NOTE: Invalid data for Rep in line 4 1-5.
NOTE: Invalid data for Loc in line 5 1-8.
NOTE: Invalid data for Std in line 5 9-16.
NOTE: Invalid data for _1 in line 5 17-24.
RULE:
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+---
1 Trial - 2015,,,,, 17
2 ,,,,, 5
3 food quality data,,,,, 23
4 ,,,,, 5
5 Plot,Cultigen number,Rep,Loc,Std,1 34
Plot=. Cultigennumber=. Rep=. Loc=. Std=. _1=. _ERROR_=1 _N_=1
NOTE: 6 records were read from the infile "C:\Users\Guo\Desktop\\trail
2015.csv".
The minimum record length was 5.
The maximum record length was 34.
NOTE: SAS went to a new line when INPUT statement reached past the end of a
line.
NOTE: The data set WORK.FOODQUALITYDATA has 1 observations and 6 variables.
NOTE: DATA statement used (Total process time):
real time 0.34 seconds
cpu time 0.32 seconds

The output is like this :


SAS Output
The SAS System
Obs Plot Cultigennumber Rep Loc Std _1
1 . . . . . .

do you know why? hoe can I fix it thanks.


MadhuKorni
Quartz | Level 8
data FoodQualityData;
infile "path/filename.csv" firstobs = 6 dsd;
input Plot Cultigen number Rep Loc $ Std _1;
run;

open your file and check from which line the data starts and mention it in firstobs option.
I found only 7 variables in the files. So, I mentioned only 7 variables in the input statement. Ex : if the data starts from 6th line mention firstobs = 6 if it starts from 10th line then firstobs = 10
wguo1
Calcite | Level 5
The code:

 

COMMENT READ QUALITY DATA;

   DATA DST1;

      INPUT PLOT CLe /*more , input 18 Variable*/;

      DATALINES;

Amir
PROC Star

Hi,

 

If your data is in a separate csv file then there should be no need to use datalines as shown in your code. The data step you have shown is incomplete. Please copy and pate the log, showing the SAS code and any messages after it is executed.

 

You can use the infile statement to specify the csv file and path:

 

http://documentation.sas.com/?docsetId=lestmtsref&docsetTarget=n1rill4udj0tfun1fvce3j401plo.htm&docs...

 

A simple example template is:

 

data dst1;
   infile '<your-path-and-file-name.csv>' dsd;
   input <your-variable-names-and-formats>;
run;

 

I cannot download your file, but from what @gamotte has shown it does not appear to have a clear structure which is why it would be helpful to also see the output you expect to see, based on the file you've provided, also as @gamotte has advised. You might need some extra logic in your data step to help you read in the csv file.

 

 

Regards,

Amir.

gamotte
Rhodochrosite | Level 12

Which program ?

 

The log message says that SAS has created a dataset DST1 in the work library. This dataset has 18 columns but no row of data, i.e. it's an empty dataset.

 

Can you show the code and describe expected output.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 3032 views
  • 0 likes
  • 4 in conversation