sas >> how to read multiple line into one variable?

by zhujp98 » Fri, 29 May 2009 21:37:52 GMT

data mid;
input metricid;
cards;
99 7 9 2 5 77 78 79 80 81 100 82 98 107 83 84 86 87 101 91 92 93 94 95 96 97
102 103 104 105 106 108 109
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 144
;
run;

How to modify this program to make it work?
Thanks.
Jeff


sas >> how to read multiple line into one variable?

by dorjetarap » Fri, 29 May 2009 21:45:31 GMT


Double trailing @

data mid;
input metricid @@ ;
cards;
99 7 9 2 5 77 78 79 80 81 100 82 98 107 83 84 86 87 101 91 92 93 94 95 96 97
102 103 104 105 106 108 109
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 144
;
run;


2009/5/29 Jeff < XXXX@XXXXX.COM >:



sas >> how to read multiple line into one variable?

by gerhard.hellriegel » Fri, 29 May 2009 22:10:26 GMT

It's a nice question like "don't know what it should do, but how do I get
it...?"
Is it really so complicated to write some words about what should be the
result?

Also something like that:

data mid;
infile cards missover;
input metricid1-metricid666 ;
cards;
99 7 9 2 5 77 78 79 80 81 100 82 98 107 83 84 86 87 101 91 92 93 94 95 96
97
102 103 104 105 106 108 109
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 144
;
run;

might be the answer without knowing what's the target...

My first question about that is: what does not work? There is no error in
the provided program,

so where is the problem, why modify it?

Gerhard





On Fri, 29 May 2009 15:45:31 +0200, karma < XXXX@XXXXX.COM >


97
96 97


how to read multiple line into one variable?

by jclark » Fri, 29 May 2009 23:00:22 GMT

Jeff,

Check the SAS Doc on the INPUT statement with a double trailing @.

Jack





Jack Clark
Senior Research Analyst
phone: 410-455-6256
fax: 410-455-6850
XXXX@XXXXX.COM

University of Maryland, Baltimore County
Sondheim Hall, 3rd Floor
1000 Hilltop Circle
Baltimore, MD 21250




Confidentiality Notice: This e-mail may contain information that is legally privileged and that is intended only for the use of the addressee(s) named above. If you are not the intended recipient, you are hereby notified that any disclosure, copying of this e-mail, distribution, or action taken in reliance on the contents of this e-mail and/or documents attributed to this e-mail is strictly prohibited. If you have received this information in error, please notify the sender immediately by phone and delete this entire e-mail. Thank you.-----Original Message-----
From: SAS(r) Discussion [mailto: XXXX@XXXXX.COM ] On Behalf Of
Jeff
Sent: Friday, May 29, 2009 9:38 AM
To: XXXX@XXXXX.COM
Subject: how to read multiple line into one variable?

data mid;
input metricid;
cards;
99 7 9 2 5 77 78 79 80 81 100 82 98 107 83 84 86 87 101 91 92 93 94 95
96 97
102 103 104 105 106 108 109
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 144
;
run;

How to modify this program to make it work?
Thanks.
Jeff


Similar Threads

1. one variable on multiple lines

2. How to write one title in multiple lines?

Hi all,

I have a quick question about entering title in SAS.
I have very long titles, e.g., "This is an extremely very
loooooooooooong title".
I would like use one 'title' command to put the title in two or three
lines, instead of using multiple title commands like title1 = "...",
title2 = "...", title3 = "...".

A similar question is that when the labels of certain charts (bar
charts) are too long, if they are written in one line, they are
truncated, so I also would like to write them in multiple lines.

Is there anyway to do these?

Thank you!!!

3. Question about reading in one-lined long file

4. Recode multiple variable into one variable

Dear all:

Please send me notes if you know how to solve this.

I have 6 variables (ULCER,SCAR,ACR,NEO, VAC, AEOT)
9 and are coded as 'Y' or 'N' , I would like it to be recoded into one
variable., say REASON with 6 values corresponding to the 6 variables
when ULCER,SCAR,ACR,NEO, VAC, AEOT are in ('Y')

here is my code. I wander if there are some other ways to do it? marco
or sql or else? thanks.

data a1;
  set me;
       if ulcer in ('Y','y') then do;
      ae_code =1; output;
       end;

       if scar in ('Y','y') then  do;
        ae_code =2; output;
      end;

        if acr in ('Y','y') then do;
        ae_code =3; output;
       end;

        if neo in ('Y','y') then do;
         ae_code =4; output;
        end;

       if va in ('Y','y') then do;
      ae_code =5; output;
      end;

        if aeot in ('Y','y') then do
        ae_code =6; output;
       end;
 run;

5. Creating multiple dichotomous variables from one variable

6. Read records with multiple lines (hierarchical format)

I know this must be posted before and did find some old posts
regarding to this but none of them fits the data I have in hand. So I
really appreciate if someone will offer help on this.

Basically, the data (.txt format) I have is exported from an Access
database, with semicolon as delimiter. When I open it up with text
pad, each record is spreading across multiple lines and it's not even
consistent. Some are in more lines than others. Below is one example
of the records.

108;"ABCD";8/10/2007 0:00:00;"ABC Company
1234 maple st
Santa Ana, California ";"DEF company
5678 apple rd
Brea, CA";"user";"Active"

I have been looking up online but with little avail. Please help if
you have experience on this. Thanks.

7. Reading Multiple Lines of Data per Observation

8. Reading delimited data on multiple lines

I am trying to input a delimited file in which some (not all)
observations
are on multiple lines; the number of lines is unpredictable. [SAS
9.1.3 UNIX]
The following example code produces the desired output:

DATA OK;
INFILE DATALINES DLM="#" DSD;
INPUT W X A :$13. Y Z;
DATALINES;
1#2#HELLO KIDDO##8
3#4#GOODBYE KIDDO#9#7
5#6#MAMA WINS###
;
RUN;

CORRECT OUTPUT
   Obs  W   X                    A           Y    Z

    1     1    2    HELLO KIDDO         .     8
    2     3    4    GOODBYE KIDDO   9    7
    3     5    6    MAMA WINS           .     .



This code reads sample data that closely resembles the actual data I'm
working with:

DATA NOTOK;
INFILE DATALINES DLM="#" DSD;
INPUT W X A :$13. Y Z;
DATALINES;
1#2#HELLO KIDDO##8
3#4#GOODBYE
KIDDO#9#7
5#6#MAMA WINS###
;
RUN;

INCORRECT OUTPUT
    Obs  W   X                  A        Y    Z

     1     1    2    HELLO KIDDO    .    8
     2     3    4    GOODBYE         .    9
     3     5    6    MAMA WINS      .    .

Note that the value for A in obs 2 has 2 errors; all other values are
correct.
The actual raw data set includes 37 vars and 32 obs - I can fix the
problem
in this case by manually deleting LFs until each obs is on a single
line, but
I need to produce code that will handle potentially much larger files.

I have tried a number of tricks but nothing even comes close to
resolving
the problem.

I would be most grateful for any insight.

Thanks,
Don