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

What is wrong with this code?

 

Data Mite;

Input obs  time;

Cards;

      0   8

     1   14 

      0   17

      1   20

;

Run;

 

 

data MItest;

set MIte;

if obs=0 then ttime=.; else ttime=time;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Nothings wrong, it runs without error. 

Why do you think something is wrong?

 

Remember we can't read your mind 😉

So if something unexpected is happening you need to explain what you expect and what isn't happening. Given what you've provided I have no idea what you want. 

 

1    Data Mite;
2    Input obs  time;
3    Cards;

NOTE: The data set WORK.MITE has 4 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.18 seconds
      cpu time            0.01 seconds


8    ;
9    Run;

10   data MItest;
11   set MIte;
12   if obs=0 then ttime=.; else ttime=time;
13   run;

NOTE: There were 4 observations read from the data set WORK.MITE.
NOTE: The data set WORK.MITEST has 4 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

View solution in original post

3 REPLIES 3
Reeza
Super User

Nothings wrong, it runs without error. 

Why do you think something is wrong?

 

Remember we can't read your mind 😉

So if something unexpected is happening you need to explain what you expect and what isn't happening. Given what you've provided I have no idea what you want. 

 

1    Data Mite;
2    Input obs  time;
3    Cards;

NOTE: The data set WORK.MITE has 4 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.18 seconds
      cpu time            0.01 seconds


8    ;
9    Run;

10   data MItest;
11   set MIte;
12   if obs=0 then ttime=.; else ttime=time;
13   run;

NOTE: There were 4 observations read from the data set WORK.MITE.
NOTE: The data set WORK.MITEST has 4 observations and 3 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
desireatem
Pyrite | Level 9

There was no error, I had the data set opened,that is why

ballardw
Super User

Sounds like you had an ERROR. Show the error from the Log and the code submitted that generated the error.

 

If you had posted something like

ERROR: You cannot open USER.JUNK.DATA for output access with member-level control because

USER.JUNK.DATA is in use by you in resource environment ViewTable Window.

 

we could likely have told you that you had the set or an explorer window about the contents open.

 

sas-innovate-2024.png

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.

 

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
  • 3 replies
  • 943 views
  • 0 likes
  • 3 in conversation