BookmarkSubscribeRSS Feed
rajeshalwayswel
Pyrite | Level 9
data have;
input xyz a b c total;
cards
a       1     2         3         6
b       4     5         6        15
c       2     3         4          9
total   7    10       13       30
run;

required:

vertical a column total 7 need to divide with all a veriable vertical rows only similarly vertical b,c,total

4 REPLIES 4
Kurt_Bremser
Super User

Start by posting working code:

24         data have;
25         input xyz a b c total;
26         cards
27         a       1     2         3         6
           _
           22
           76
ERROR 22-322: Syntax error, expecting one of the following: ;, CANCEL, PGM.  

ERROR 76-322: Syntax error, statement will be ignored.

28         b       4     5         6        15
29         c       2     3         4          9
30         total   7    10       13       30
31         run;
32         
33         
34         GOPTIONS NOACCESSIBLE;
35         %LET _CLIENTTASKLABEL=;
36         %LET _CLIENTPROJECTPATH=;
37         %LET _CLIENTPROJECTNAME=;
38         %LET _SASPROGRAMFILE=;
NOTE: DATA statement used (Total process time):
      real time           0.05 seconds
      cpu time            0.00 seconds
      
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.HAVE may be incomplete.  When this step was stopped there were 0 observations and 5 variables.

rajeshalwayswel
Pyrite | Level 9

Thanks for the inputs. I'll put my efforts.

Tom
Super User Tom
Super User

That looks like a cross tab.  Why not start with the raw data and let SAS generate the report you need?

data have;
  length var1 var2 $8 amount 8;
  input var1 $ @ ;
  do var2='a','b','c';
    input amount @ ;
    output;
  end;
cards;
a   1 2 3
b   4 5 6
c   2 3 4
;

proc freq data=have ;
  tables var1*var2 ;
  weight amount ;
run;

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