BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Koke
Fluorite | Level 6

Hello, guys

I'm struggling in a date issue. I searched for informat date statement and did not find this type of format M-DD-YY.

here is my data

3-05-98,5.79,7.69,112.8,128,47,46.7,10.6
4-06-98,4.75,5.49,61.3,75,20,19.3,7.1
4-07-98,4.95,5.79,65.5,62,20,19.8,7.6
2-25-98,5.34,6.77,.,102,33.5,33.5,8.3

 

This my code

data limes
;
infile "/folders/myshortcuts/SASUniversityEdition/module 3/limes.txt"
firstobs=2 dsd
;
input
date fruitdia f_length fruit_Wt f_vol J_vol juice_wt peel_wt
;
proc
print data = limes
;

  Obs date fruitdia f_length fruit_Wt f_vol J_vol juice_wt peel_wt 1 2 3 4 5 6

.5.797.69112.812847.046.710.6
.4.755.4961.37520.019.37.1
.4.955.7965.56220.019.87.6
.5.346.77.10233.533.58.3
.5.446.1686.610032.031.88.7
.6.717.46164.218467.067.515.7


Thank you guys

 

1 ACCEPTED SOLUTION

Accepted Solutions
kiranv_
Rhodochrosite | Level 12

this worked for me

data limes
;
infile datalines dsd ;
;
input 
date:mmddyy10. fruitdia f_length fruit_Wt f_vol J_vol juice_wt peel_wt;
format date date9.;
datalines;
3-05-98,5.79,7.69,112.8,128,47,46.7,10.6
4-06-98,4.75,5.49,61.3,75,20,19.3,7.1
4-07-98,4.95,5.79,65.5,62,20,19.8,7.6
2-25-98,5.34,6.77,.,102,33.5,33.5,8.3
;

View solution in original post

3 REPLIES 3
Reeza
Super User

Try the informat of ANYDTDTE or MMDDYY10.  Either appeared to work fine for me.

 


@Koke wrote:

Hello, guys

I'm struggling in a date issue. I searched for informat date statement and did not find this type of format M-DD-YY.

here is my data

3-05-98,5.79,7.69,112.8,128,47,46.7,10.6
4-06-98,4.75,5.49,61.3,75,20,19.3,7.1
4-07-98,4.95,5.79,65.5,62,20,19.8,7.6
2-25-98,5.34,6.77,.,102,33.5,33.5,8.3

 

This my code

data limes
;
infile "/folders/myshortcuts/SASUniversityEdition/module 3/limes.txt"
firstobs=2 dsd
;
input
date fruitdia f_length fruit_Wt f_vol J_vol juice_wt peel_wt
;
proc
print data = limes
;

  Obs date fruitdia f_length fruit_Wt f_vol J_vol juice_wt peel_wt 1 2 3 4 5 6

. 5.79 7.69 112.8 128 47.0 46.7 10.6
. 4.75 5.49 61.3 75 20.0 19.3 7.1
. 4.95 5.79 65.5 62 20.0 19.8 7.6
. 5.34 6.77 . 102 33.5 33.5 8.3
. 5.44 6.16 86.6 100 32.0 31.8 8.7
. 6.71 7.46 164.2 184 67.0 67.5 15.7


Thank you guys

 


 

kiranv_
Rhodochrosite | Level 12

this worked for me

data limes
;
infile datalines dsd ;
;
input 
date:mmddyy10. fruitdia f_length fruit_Wt f_vol J_vol juice_wt peel_wt;
format date date9.;
datalines;
3-05-98,5.79,7.69,112.8,128,47,46.7,10.6
4-06-98,4.75,5.49,61.3,75,20,19.3,7.1
4-07-98,4.95,5.79,65.5,62,20,19.8,7.6
2-25-98,5.34,6.77,.,102,33.5,33.5,8.3
;

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 3 replies
  • 791 views
  • 2 likes
  • 4 in conversation