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

Hi!!! please help me out to get output for this input without using if statement and loops

Input:

110 111 101 113 109

108 105 101 109 101

122 123 124 125 101

127 128 129 130 103

102 103 101 104 107

106 107 101 109 103

101 109 107 109 107

111 101 999 105 101

Output:


110 111 101 113 109

111 101 999 105 101

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Sounds like another question from the same homework assignment.  Similar tools, which you may need to look up and study:

data want;

  set have nobs=_nobs_;

  output;

  set have point=_nobs_;

  output;

  stop;

run;

Good luck.

View solution in original post

4 REPLIES 4
pau_figuera
Calcite | Level 5

Rambo_UK

Hi Rambo, here's my solution (its in 2 data steep) I hope it usefull.

Pau Figuera (Spain)

data rambo;

     input var1 var2 var3 var4 var5;

     cards;

       110 111 101 113 109

       108 105 101 109 101

       122 123 124 125 101

       127 128 129 130 103

       102 103 101 104 107

       106 107 101 109 103

       101 109 107 109 107

       111 101 999 105 101

     ;

     run;

data rambo;

  set rambo;

  counter = 0;

run;

data rambo_counter (drop = counter);

  set rambo;

  by counter;

  if first.counter then  output;

  counter = counter +1;

  if last.counter then  output;

run;

proc print data = rambo_counter;

run;

Rambo_UK
Calcite | Level 5

Thanks Pau its working perfect.

Astounding
PROC Star

Sounds like another question from the same homework assignment.  Similar tools, which you may need to look up and study:

data want;

  set have nobs=_nobs_;

  output;

  set have point=_nobs_;

  output;

  stop;

run;

Good luck.

Rambo_UK
Calcite | Level 5

Thanks Astounding its working like charm.

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