|
Howard:
Since both column pointers point to a column that precedes or begins
'Ikke_forskudd', both should read the entire string (under the default of
delimiter=' '). The code-value length of 1 truncates the string to 'I'.
Change the length of code_value to 12 to see the value of code_value prior
to the truncation to one character.
Sig
-----Original Message-----
From: Howard Schreier [mailto:Howard_Schreier@ITA.DOC.GOV]
Sent: Tuesday, February 03, 2004 1:22 PM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: The datalines
Richard gave the list input solution.
Using column style, this INPUT statement works:
input code_value 1
explanation 3-42;
Or, informats can be applied:
input @1 code_value $1.
@3 explanation $40.;
I was a little surprised at the results of Rune's code:
code_
Obs value explanation
1 I Ikke_forskudd
...
Would somebody explain precisely how "Ikke_forskudd" got scanned into
EXPLANATION after the initial "I" went into CODE_VALUE?
On Tue, 3 Feb 2004 10:38:04 -0500, Richard A. DeVenezia
<radevenz@IX.NETCOM.COM> wrote:
>"Rune Runnestoe" <rune@fastlane.no> wrote in message
>news:24410121.0402030228.5ef26c2a@posting.google.com...
>> Hi,
>> below is a code I want to improve if possible. First, is there any
>> way I can mark that a blank value can be a valid code value, like
>> "Ikke_forskudd" ? Second, how do I make the whole explanation appears
>> in the dataset column without having connect the words in the string
>> with underscores, like "Bare forskuddsskatt" ?
>>
>> data &bibl..forskuddsform_kode;
>> attrib code_value length=$1 label="Forskuddsform"
>> explanation length=$40 label="Forklaring";
>> infile cards;
>> input @1 code_value
>> @3 explanation;
>> datalines;
>> Ikke_forskudd
>> 0 Intet
>> 1 Tabellkort
>> 2 Prosentkort
>> 3 Bare_forskuddsskatt
>> 4 Frikort
>> 5 Fritaksmelding
>> 6 Bare_selvangivelse
>> ;
>>
>>
>> Regards
>> Rune Runnestoe
>
>You can use the list input argument & when reading a character value
>containing single embedded blanks. Per help
>"& indicates that a character value may have one or more single embedded
>blanks. This format modifier reads the value from the next non-blank column
>until the pointer reaches two consecutive blanks, the defined length of the
>variable, or the end of the input line, whichever comes first.
>"
>
>In this case the pointer reaches the end of the input line.
>
>data format;
>length start $1 label $40;
>input start label & ;
>cards;
>. Unknown code
>1 Code 1
>2 Code 2
>3 Code 3
>4 Code 4
>5 Code 5
>6 Code 6
>;
>run;
>
>--
>Richard A. DeVenezia
>http://www.devenezia.com/
|