11-19-2015 03:58 PM - edited 11-19-2015 04:00 PM
here is the deal: I am creating a table with some variables and the 'observations' are read from a .txt file here is my code f
infile 'a path'
input id kon $ alder utb $@@;
ok that works out fine however it is adding a blankspace to each observation in my variable 'utb' which is a problem. If I now add data to this existing table with the INPUT statement for example I add: 29 M 20 GY it will not create extra blankspace to GY which means that any observation in my table which has GY+blankspace will not be "the same" as the GY which I added with the input statement since one has the blankspace and the other one doesnt
what can I do?
11-19-2015 04:11 PM
It is very hard to resolve a data reading issue without example data. Provide a few lines of data.
Also, how are you "adding" data? Append, merge, update or something else? I'm pretty sure I don't understand your limitation/problem as stated.
11-19-2015 04:33 PM
It sounds like you have a few misconceptions. Consider these basic concepts.
Both KON and UTB have a length of 8 characters. That's the default length assigned for the style of INPUT statement that you are using.
When you refer to a variable, trailing blanks don't matter. These statements always find the same matches:
if utb='GY' then do;
if utb='GY ' then do;
When SAS detects that it is comparing character strings that have different lengths, it automatically pads the shorter string with blanks to make the lengths equal. (That is, for purposes of making the comparison ... it is not actually changing the values of any variables.)
Does that change the questions that you want to ask?