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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 845 views
  • 2 likes
  • 4 in conversation