BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Cayson
Fluorite | Level 6

 URGENT!! so im working on a project for my biostats class and im using a fairly large data set that is 3 columns wide. whenever i try to run even basic tests, it just says invalid data. I have had a similar problem before where i had to backspace between each value and put a new space which works here but i cannot do that with such a large data set. so here are my commands and the log and the results. Please helpCapture.JPGCapture3.JPGCapture4.JPGCapture5.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

In most SAS editors, you can highlight the tab (delimiter) and press CTRL+H (Find And Replace). Then simply replace all tabs with spaces, like below. Works in Notepad, Notepad++ and so on as well.

 

PeterClemmensen_0-1669058544891.png

 

View solution in original post

11 REPLIES 11
PeterClemmensen
Tourmaline | Level 20

Can you post your entire data set as code?

Cayson
Fluorite | Level 6

 

data;
input alz smoking glyphosates ;

z=_n_;

if z le 67 then state='Alabama';
if z ge 68 and z le 125 then state='California';
if z ge 126 and z le 192 then state='Florida';
if z ge 193 and z le 351 then state='Georgia';
If z ge 352 and z le 407 then state='Montana';
if z ge 408 then state='Oregon';
datalines;

1.191747935 25.46 10.84522
0.712663798 22.84 40.47304
1.590696564 26.96 8.4501
0.851423527 29.66 0.26632
0.679871229 28.04 5.27118
1.865486954 27.36 3.15849
1.194524996 28.34 2.22379
0.971702454 27.94 6.5098
2.160215578 28.82 0.42396
2.231370955 26.4 36.2602
0.760442522 28.14 1.29187
1.053687278 24.34 1.41613
2.152105518 24.62 0.23463
0.697671928 29.22 0.21831
0.82609172 29 0.33162
1.913210396 23.96 22.52306
0.891834096 26.06 30.07018
0.895134617 27.8 7.64968
0.553613968 29.88 0.08705
1.706255914 29.86 15.91443
1.922831698 27.26 3.7547
1.502484098 27.82 8.39633
0.974955201 24.04 12.57345
1.466074975 26.84 28.72183
1.087983384 26.86 16.73163
1.273701982 26.6 16.43184
1.455664674 29.02 31.98901
1.72686389 28.44 7.73939
1.570100675 27.02 4.80343
0.748749647 26.86 5.3184
1.984411264 28.46 28.36352
0.336653333 25.76 1.23016
0.664689402 25.76 9.98807
1.637890327 24.16 22.65508
1.331736135 24.72 28.19651
1.060062733 28.46 37.16118
0.998583718 22.86 0.38816
1.173714851 27.02 0.78872
2.380867047 23.8 42.33589
1.096723525 27.5 46.66435
0.701360111 21.26 1.44141
1.050836009 24.94 70.77533
1.035092478 25.88 10.34846
0.791220666 24.84 9.3056
1.096569718 21.26 70.38861
0.492518743 22.14 7.25561
1.732817732 27.76 2.98058
1.255041451 28.12 6.48451
0.949874482 26.6 14.94825
1.433691873 26.1 28.70164
1.154728111 22.32 10.22681
1.109809969 27.06 10.52946
1.990780526 25.56 12.2361
0.947287888 26.3 5.11391
0.930301598 22.9 8.1035
1.365104224 29.42 0.8532
1.282496751 28.12 4.3825
1.043335502 26.56 0.26635
0.672223356 18.74 3.62684
0.337438589 24 3.07879
0.905373329 27.16 10.8093
0.841258578 27.32 0.73759
0.699091687 22.98 5.60872
1.003607259 29.08 0.80284
1.238096203 25.3 1.96069
1.111286615 25.6 2.70761
1.493031651 28.7 0.41461
1.092742809 13.74 1.63166
0.391976208 18.96 0.0006
1.30386096 22.76 0.84414
1.578553052 21.14 48.635
0.547295943 20.26 0.5808
1.110521608 20.06 46.1488
1.563244944 14.18 7.8804
0.670795272 27.08 0.23228
1.068689993 17.34 1.28156
1.277348929 17.5 486.8381
0.885594528 21.54 62.08576
0.843693637 22.5 0.06106
0.582739544 16.94 11.63186
0.223219481 20.8 0.0183
1.181795389 18.66 477.13358
1.148079107 18.2 165.7728
0.918976582 24.3 3.85936
0.794196562 24.9 0.56034
1.192118001 14.4 2.53124
1.336550372 19.76 249.93584
1.311259361 12.72 0.04084
1.046413124 19.56 0.099
0.565135093 23 5.0591
0.940295664 18.56 199.86124
0.666049624 22.32 0.93658
0.949570115 18.04 0.28018
0.773657895 15.84 26.73546
1.262591866 15.88 17.07314
0.782703009 17.32 0.12062
1.578383447 12.6 5.12668
1.600583341 15.24 1.32488
0.601132901 21.48 0.02048
1.292379016 17.7 31.22862
1.118275538 17.88 32.76964
0.502142111 15.82 4.73684
1.092608991 18.6 3.13492
1.654262478 14.6 14.76564
1.634401005 12.66 0
1.495965236 19.3 116.05534
0.850757009 14.74 19.27498
1.580121852 11.94 0.46804
1.302802043 13.9 22.56418
1.769227783 11.6 1.60766
1.08998883 13.74 0.69122
1.62578113 23.6 1.16792
0.336854144 22.26 0.0164
0.72793273 22.02 1.82188
1.625719093 17.08 12.91482
1.525955437 17.32 31.28734
1.661767151 19.46 164.67586
1.24126525 19.46 33.391
0.945252819 24.26 26.4991
0.448996164 23.72 0
0.739593292 17.64 311.26018
0.570271016 23.04 0.02184
1.401769352 14.3 52.37034
1.52197319 14.06 43.52378
0.859602735 21.98 9.404
0.687272779 18.1 4.69938
1.309515894 28.56 0.24024
1.74414228 26.4 0.09074
0.817363944 29.14 0.33458
1.145518739 24.58 6.84127
0.548393696 18.72 0.24497
1.662451154 29.52 9.21186
0.475832835 26.48 26.83665
0.519671995 29.5 0.40791
0.954278306 22.7 0.4146
1.011956801 20.3 45.37794
0.356564462 29.66 2.8916
0.219662322 28.18 113.20405
0.415101918 32.84 0.45506
0.676134679 23.8 0.40488
1.181159523 25.74 14.37814
0.458703858 26.42 0.25515
1.34416483 29.52 0.0074
0.926410522 24.34 1.88035
0.40679312 28.12 3.40024
0.670644671 28.14 31.23518
1.3319069 29.76 0.03733
0.486451054 30.9 3.20625
0.484441073 24.24 89.10641
0.575363564 24.48 253.1553
0.826320681 28.3 1.80038
0.377508749 26.2 117.39088
1.001322199 21.06 27.67042
1.704914911 29.66 7.50006
1.047312871 24.96 108.69496
2.104380405 25.88 43.94328
0.719682213 25.82 4.11499
0.759965535 29.12 2.56655
1.245887105 23.6 21.56118
0.509911409 22.92 20.66457
0.611143888 17.18 0.48327
0.676876986 28 5.27824
1.204927241 28.44 0.37748
0.707757331 27.38 5.75977
0.460009627 23.64 43.47075
1.040063858 25.46 5.08056
0.589891217 22.54 65.601
0.896967006 16.74 12.91798
0.46837061 22.72 0.0004
0.699281202 24.46 0.21177
1.08941633 24.78 4.27434
1.024830325 29.18 19.44141
0.797840356 18.88 12.48948
0.737245628 22.02 15.13699
0.638207034 19.34 113.21249
0.715010038 27.68 13.61391
0.703168313 26.18 0.0295
0.536183343 24.28 159.70194
0.748760926 28.92 0.86108
0.444077213 19.34 1.30082
0.784559524 25.36 119.26625
1.016855128 24.38 28.62434
0.555167217 24.66 1.91622
0.838547003 19.96 1.33484
0.646596902 26 0.7236
0.530166911 29.22 8.9779
0.46033417 30.28 0.24515
0.437954625 30.68 0.3487
0.802716448 26.38 3.10106
0.868946813 27.26 0.27003
1.243042207 26.76 5.69695
1.129292495 29.64 4.25209
1.580089304 25.84 22.98097
1.047564531 27.46 12.46515
1.065428176 28.42 10.94357
0.467677248 26.42 14.03298
0.399324888 25.24 0.39013
1.183511485 25.74 0.94655
0.730050201 24.16 0.2827
1.523694294 26.5 13.01419
1.599281608 27.96 10.66101
0.871842633 28.66 27.22047
1.093726317 23.88 0.76883
0.692699429 26.58 12.18268
0.85223221 30.24 1.35749
0.396304341 26.9 38.5353
1.092107177 21.08 1.22186
1.219893829 21.92 42.13614
0.601344022 27 28.26735
1.036993559 28.26 0.44201
0.600336366 26.7 14.0941
0.567398559 23.8 0.05986
2.443092622 24.9 11.01276
1.145589758 25.38 0.38145
1.509774964 25.54 0.07252
0.964402988 30.48 0.2442
0.842297579 22.44 0.03055
1.779307313 19.38 0.01834
2.725584268 30.06 5.67278
0.551572002 19.94 0.17086
0.709489476 18.08 0.06645
0.585859719 27.46 5.56687
0.422619314 22.26 0.00438
1.162658074 27.28 0.18193
0.722865508 17.14 0.04637
0.565811915 27.16 32.85157
1.370767299 27.28 48.52422
1.103466104 19.12 0.17062
1.846453888 28.76 17.84078
0.954416288 21.88 0.40975
0.677176385 26.04 2.57555
1.413180674 28.16 31.36842
2.102000596 24.38 0.06692
0.743399347 23.74 0.50202
0.733581617 25.88 28.49216
0.441673934 17.04 0.00201
1.083440129 25.78 14.63362
1.28380502 28.56 54.95679
1.232410228 24.7 3.11944
0.648746613 22.92 0.13097
1.08329124 26.26 26.34036
1.15702459 26.94 1.57855
0.912276172 24.16 5.68045
1.627862166 27.14 1.97457
2.025354056 27.18 16.81352
2.757058023 27.04 5.02152
1.158377252 26.48 0.67763
0.888268324 16.54 0.03645
1.860558882 26.04 11.6899
0.411422789 15.92 0.16369
1.176472946 25.74 3.33896
0.659665361 16.48 0.25733
0.872645441 27.16 0.85611
2.146773384 26.78 1.01525
1.289407477 22.98 0.09004
2.45599217 27.24 13.16148
0.89424679 25.58 19.01362
0.3860923 24.3 0.85565
0.504599799 16.86 0.13763
1.457858656 23.78 1.66936
0.656838112 21.68 4.34312
0.4154321 27.54 0.48984
1.948457191 29.06 0.12102
0.828241242 19.9 0.23818
0.980169794 24.66 11.07176
1.755847961 29.66 0.08937
0.730456538 20.72 0.16963
0.974540425 22.38 9.33228
1.836979098 28.66 34.6684
1.478644657 23.12 4.86769
0.474219554 25.24 0.78593
1.475709424 25.52 19.18018
1.284238991 26.44 19.30174
0.761311884 26.58 15.47987
0.73887683 28.26 4.71774
0.660407816 23.42 0.53254
1.155383134 26.58 0.28644
1.972648062 27.54 6.90488
1.041476065 24.74 16.41253
1.100169545 24.44 15.04357
0.413787983 23.16 0.08488
0.793433641 26.52 0.32088
0.834066965 26.28 0.94279
0.539202588 24.78 6.13849
0.690551377 22.4 0.45606
1.240164458 28.5 0.4604
0.594418121 26.5 0.08541
1.340881187 29.16 14.08266
1.237783236 27.72 4.94338
1.647299511 26.32 2.41451
1.200879428 28.4 0.48561
0.903389795 25.98 23.05064
1.676709814 28.24 41.1505
0.992622761 24.34 0.54971
1.101252945 24.1 5.18011
0.442116344 22.1 2.06199
1.964642962 29.74 11.84188
1.365974373 24.58 0.02237
0.869712674 23.6 1.04105
0.63522143 16.08 2.92684
0.759904721 24.64 3.27254
0.93954394 23.66 0.01279
0.90538517 24.14 5.14758
0.703249124 24.76 0.51304
0.679305818 26.82 14.81761
1.242731579 24.14 0.29298
1.773109918 28 6.05466
0.847990194 29.12 14.45793
0.765951192 22.94 0.96883
0.65905971 28.74 0.52685
0.821056327 22.76 0.22282
0.422685351 25.94 11.57555
1.07871282 25.2 0.44857
0.827608518 20.42 0.12192
1.201282117 26.66 1.22086
2.047917922 26.76 25.15368
0.444266077 25.38 21.44717
0.816303847 26.64 0.21131
2.26855481 26.18 0.33467
1.159858099 26.9 2.81202
2.2126249 24.86 22.17365
0.685073422 26.08 0.11732
0.526999915 27.9 0.24165
1.698762016 27.28 15.4971
0.896929467 27.94 5.2091
0.806379158 27.26 7.01172
0.732814872 28.24 20.35461
0.932274501 25.3 24.75677
1.997981726 25.56 20.46768
1.202135002 24.22 9.39157
0.9434391 23.18 0.4311
0.940842889 28.6 2.6051
0.810855868 25.34 0.11062
1.40361966 28.36 22.85275
0.542015189 27.88 5.90459
1.316727404 22.28 1.1374
1.763227376 28.46 0.20325
1.425870581 27.74 5.88344
0.920619768 23.94 6.22014
1.239742531 26.94 5.1147
1.219320036 28.44 1.57947
0.402364469 27.08 7.5666
0.917701161 27.08 10.32355
0.454560366 25.06 6.29201
1.809135084 28.6 5.36903
0.916280274 22.52 2.16715
1.479247441 25.68 2.10445
1.773064452 28.52 24.69645
0.746061436 27.54 1.31596
0.480486631 25.6 0.80263
1.457909066 28.3 48.59278
0.696560037 19.7 4.1614
0.685045394 31.28 31.93188
1.236557327 28.42 117.00091
0.740664416 24 19.48243
0.45931739 19.74 10.82114
0.518943979 23.54 20.26931
1.727877079 22.96 65.56351
0.750316339 23.32 241.62315
0.919250854 24.14 21.472
0.188911126 20.56 66.46143
1.067569576 23.12 57.24022
0.306011165 27.04 0.16694
1.487847533 22.56 17.13978
0.529178779 23.02 68.51582
0.500794171 20.26 4.59118
0.429652069 14.7 15.50192
0.769755177 23.5 51.99561
0.812640471 31.2 92.65241
0.135472384 21.44 13.44813
0.401029531 22.02 0.61561
0.675206784 26.72 218.32264
0.42795656 18.96 2.49268
0.501837191 19.24 24.50402
0.332972703 25.16 4.00112
0.514943429 19.12 9.24857
0.560609539 25.3 122.00204
0.494447012 22.44 0.06903
0.275014907 18.02 71.246
0.285490922 20.64 4.10598
0.318129629 26.52 6.37603
0.44936005 26.5 0.06933
0.602207598 19.14 0.59303
0.402636577 23.52 10.91469
1.081935316 19.52 3.40999
0.738318255 21.26 18.89931
1.855953025 24.88 80.39396
0.554954193 24.98 112.70753
0.391486031 21.88 11.81945
0.984425847 25.82 0.70757
0.193404891 22.44 23.73554
0.645893146 21.2 1.82125
1.01688187 25.14 67.44618
1.134699889 32.62 97.90982
0.424202999 25.04 37.39262
0.645088708 24.3 0.53094
0.960792408 23.54 81.06633
1.000829387 26.36 0.07532
1.167714907 20.86 12.13005
0.326492259 20.38 2.47675
1.228467342 20.22 96.84086
0.582148874 26.14 145.84309
0.121461061 21.04 7.5919
1.236648743 25.28 106.78033
0.403421145 24.16 11.70517
0.172399608 22.94 20.16575
1.117418409 22.22 39.49979
0.632844711 24.98 2.65274
0.96121917 14.98 2.33194
1.055770639 17.72 3.61937
0.834959292 24.54 0.03021
0.675408066 25.04 0.16545
1.144061355 29.16 0.20381
0.576336302 24.74 0.81646
0.702687803 27.16 0.16802
0.921977042 18.44 0.37147
1.211033312 27.56 1.39886
0.319795314 23.52 30.38264
0.555598435 23.58 0.49715
0.390156945 25.3 1.51705
1.136709711 18.9 13.0525
1.210685883 22.8 4.03359
0.829417729 24.14 1.56812
0.840671237 26.56 0.24093
1.087756824 24.94 5.70011
2.050894844 24.04 1.249
1.08225016 21.34 3.6318
0.837672629 24.4 0.0728
1.108262912 23.16 4.44709
0.807929569 24.62 25.9151
0.765837096 20.6 15.76392
0.668665467 24.84 77.48005
1.211362433 19.54 0.80738
0.796171143 18.82 4.09345
0.6021629 23.58 72.27302
0.672417195 23.42 0.95743
1.015176443 24.9 48.5489
0.792263013 23.26 5.49769
0.260896952 22.82 1.84362
0.987441913 22.92 40.8679
1.005883435 15.38 5.02388
0.462637606 23.7 0.4222
1.122435305 19.32 6.39744

 

;
proc sort; by state;
proc univariate normal; by state; var alz smoking glyphosates; run;

PeterClemmensen
Tourmaline | Level 20

Your code works fine on my end.

Cayson
Fluorite | Level 6

it will not run for me man i dont know whats wrong

PeterClemmensen
Tourmaline | Level 20

You problem is simply that in your file, you have tabs instead of spaces in your datalines. Replace those, and you're all good 🙂

Cayson
Fluorite | Level 6
Do you know a simple way to do that? because i just paste it from excel.
PeterClemmensen
Tourmaline | Level 20

In most SAS editors, you can highlight the tab (delimiter) and press CTRL+H (Find And Replace). Then simply replace all tabs with spaces, like below. Works in Notepad, Notepad++ and so on as well.

 

PeterClemmensen_0-1669058544891.png

 

Cayson
Fluorite | Level 6
wow bro you guys are amazing you dont know how long i have been struggling with this i can finnaly work on my project
PeterClemmensen
Tourmaline | Level 20

I know the feeling. Good luck on your biostat class 🙂

Tom
Super User Tom
Super User

You should be able to change the editor settings so that tabs are not inserted when you paste them into the editor. 

 

For example here are the setting I use in SAS On Demand (free learning instance of SAS/Studio).

Tom_0-1669059317783.png

 

But you can also add an INFILE statement so you can use the EXPANDTABS option to replace the tabs with the number of spaces needed to move to the next tab stop.

data want;
  infile datalines expandtabs ;
  input a b c ;
datalines;
....

Example using an actual file:

2179  options generic;
2180  filename example temp;
2181  data _null_;
2182    set sashelp.class (obs=3);
2183    file example dsd dlm='09'x ;
2184    put name age sex height weight ;
2185  run;

NOTE: The file EXAMPLE is:
      (system-specific pathname),
      (system-specific file attributes)

NOTE: 3 records were written to the file (system-specific pathname).
      The minimum record length was 18.
      The maximum record length was 20.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds


2186
2187  data _null_;
2188    infile example;
2189    input;
2190    list;
2191  run;

NOTE: The infile EXAMPLE is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0

1   CHAR  Alfred.14.M.69.112.5 20
    ZONE  46676603304033033323
    NUMR  1C62549149D9699112E5

2   CHAR  Alice.13.F.56.5.84 18
    ZONE  466660330403323033
    NUMR  1C93591396956E5984

3   CHAR  Barbara.13.F.65.3.98 20
    ZONE  46766760330403323033
    NUMR  212212191396965E3998
NOTE: 3 records were read from the infile (system-specific pathname).
      The minimum record length was 18.
      The maximum record length was 20.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds


2192
2193  data _null_;
2194    infile example expandtabs;
2195    input;
2196    list;
2197  run;

NOTE: The infile EXAMPLE is:
      (system-specific pathname),
      (system-specific file attributes)

RULE:     ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
1         Alfred  14      M       69      112.5 37
2         Alice   13      F       56.5    84 34
3         Barbara 13      F       65.3    98 34
NOTE: 3 records were read from the infile (system-specific pathname).
      The minimum record length was 18.
      The maximum record length was 20.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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