BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
herbman
Obsidian | Level 7

Hey, I created data and sgplot as below, not sure how to produce just one smooth line from the plot of ValueRef and percent_bias, instead a number of head-tail connceting lines? I tried it using gplot, it showed similar pattern.

Thanks a lot!

Herdman

 

Data Reeses;

input Valueref ValueNew Percent_bias;

datalines;

30.81585404 29.4704343 -4.365998558

30.81585404 29.4704343 -4.365998558

30.81585404 29.4704343 -4.365998558

30.81585404 29.4704343 -4.365998558

0.900429406 0.657346118 -26.99637382

0.900429406 0.657346118 -26.99637382

0.900429406 0.657346118 -26.99637382

0.900429406 0.657346118 -26.99637382

0.863292046 0.621674579 -27.98791769

0.863292046 0.621674579 -27.98791769

0.863292046 0.621674579 -27.98791769

0.863292046 0.621674579 -27.98791769

0.826775064 0.586598817 -29.0497691

0.826775064 0.586598817 -29.0497691

0.826775064 0.586598817 -29.0497691

0.826775064 0.586598817 -29.0497691

0.790858013 0.552061678 -30.19459003

0.790858013 0.552061678 -30.19459003

0.790858013 0.552061678 -30.19459003

0.790858013 0.552061678 -30.19459003

0.755521 0.518041442 -31.4325555

0.755521 0.518041442 -31.4325555

0.755521 0.518041442 -31.4325555

0.755521 0.518041442 -31.4325555

27.7734994 26.48449593 -4.641127312

27.7734994 26.48449593 -4.641127312

27.7734994 26.48449593 -4.641127312

27.7734994 26.48449593 -4.641127312

25.25574081 24.02394444 -4.877292567

25.25574081 24.02394444 -4.877292567

25.25574081 24.02394444 -4.877292567

25.25574081 24.02394444 -4.877292567

23.13632551 21.95995769 -5.084505862

23.13632551 21.95995769 -5.084505862

23.13632551 21.95995769 -5.084505862

23.13632551 21.95995769 -5.084505862

21.32667155 20.20122098 -5.277197449

21.32667155 20.20122098 -5.277197449

21.32667155 20.20122098 -5.277197449

21.32667155 20.20122098 -5.277197449

19.76276139 18.6867063 -5.44486205

19.76276139 18.6867063 -5.44486205

19.76276139 18.6867063 -5.44486205

19.76276139 18.6867063 -5.44486205

18.39715915 17.36706773 -5.599187427

18.39715915 17.36706773 -5.599187427

18.39715915 17.36706773 -5.599187427

18.39715915 17.36706773 -5.599187427

17.19276406 16.20652314 -5.736372129

17.19276406 16.20652314 -5.736372129

17.19276406 16.20652314 -5.736372129

17.19276406 16.20652314 -5.736372129

16.12439582 15.17758644 -5.871906119

16.12439582 15.17758644 -5.871906119

16.12439582 15.17758644 -5.871906119

16.12439582 15.17758644 -5.871906119

15.16900887 14.25878881 -6.000524317

15.16900887 14.25878881 -6.000524317

15.16900887 14.25878881 -6.000524317

15.16900887 14.25878881 -6.000524317

14.30935084 13.43234312 -6.12891344

14.30935084 13.43234312 -6.12891344

14.30935084 13.43234312 -6.12891344

14.30935084 13.43234312 -6.12891344

13.53152947 12.68619606 -6.247138654

13.53152947 12.68619606 -6.247138654

13.53152947 12.68619606 -6.247138654

13.53152947 12.68619606 -6.247138654

12.82423026 12.00839288 -6.361686913

12.82423026 12.00839288 -6.361686913

12.82423026 12.00839288 -6.361686913

12.82423026 12.00839288 -6.361686913

12.17814341 11.38981986 -6.473265429

12.17814341 11.38981986 -6.473265429

12.17814341 11.38981986 -6.473265429

12.17814341 11.38981986 -6.473265429

11.58553736 10.82292332 -6.582465854

11.58553736 10.82292332 -6.582465854

11.58553736 10.82292332 -6.582465854

11.58553736 10.82292332 -6.582465854

11.039937 10.30138853 -6.689788774

11.039937 10.30138853 -6.689788774

11.039937 10.30138853 -6.689788774

11.039937 10.30138853 -6.689788774

10.53536718 9.819440088 -6.795464074

10.53536718 9.819440088 -6.795464074

10.53536718 9.819440088 -6.795464074

10.53536718 9.819440088 -6.795464074

10.06824073 9.373505332 -6.900266102

10.06824073 9.373505332 -6.900266102

10.06824073 9.373505332 -6.900266102

10.06824073 9.373505332 -6.900266102

9.634033496 8.959235832 -7.004310963

9.634033496 8.959235832 -7.004310963

9.634033496 8.959235832 -7.004310963

9.634033496 8.959235832 -7.004310963

9.229326649 8.573316886 -7.107883251

9.229326649 8.573316886 -7.107883251

9.229326649 8.573316886 -7.107883251

9.229326649 8.573316886 -7.107883251

8.851161612 8.212883437 -7.211236251

8.851161612 8.212883437 -7.211236251

8.851161612 8.212883437 -7.211236251

8.851161612 8.212883437 -7.211236251

8.49696487 7.875446084 -7.314597571

8.49696487 7.875446084 -7.314597571

8.49696487 7.875446084 -7.314597571

8.49696487 7.875446084 -7.314597571

8.164487094 7.558831261 -7.418173689

8.164487094 7.558831261 -7.418173689

8.164487094 7.558831261 -7.418173689

8.164487094 7.558831261 -7.418173689

7.851753485 7.260848821 -7.525766882

7.851753485 7.260848821 -7.525766882

7.851753485 7.260848821 -7.525766882

7.851753485 7.260848821 -7.525766882

7.557022989 6.980403068 -7.630252304

7.557022989 6.980403068 -7.630252304

7.557022989 6.980403068 -7.630252304

7.557022989 6.980403068 -7.630252304

7.278469858 6.715707673 -7.731874908

7.278469858 6.715707673 -7.731874908

7.278469858 6.715707673 -7.731874908

7.278469858 6.715707673 -7.731874908

7.015309781 6.465444523 -7.838075218

7.015309781 6.465444523 -7.838075218

7.015309781 6.465444523 -7.838075218

7.015309781 6.465444523 -7.838075218

6.766021167 6.228439434 -7.945315569

6.766021167 6.228439434 -7.945315569

6.766021167 6.228439434 -7.945315569

6.766021167 6.228439434 -7.945315569

6.529512606 6.003642954 -8.053735146

6.529512606 6.003642954 -8.053735146

6.529512606 6.003642954 -8.053735146

6.529512606 6.003642954 -8.053735146

6.304804916 5.789909674 -8.166711725

6.304804916 5.789909674 -8.166711725

6.304804916 5.789909674 -8.166711725

6.304804916 5.789909674 -8.166711725

6.091017032 5.586812336 -8.27784086

6.091017032 5.586812336 -8.27784086

6.091017032 5.586812336 -8.27784086

6.091017032 5.586812336 -8.27784086

5.887353968 5.393372891 -8.390544874

5.887353968 5.393372891 -8.390544874

5.887353968 5.393372891 -8.390544874

5.887353968 5.393372891 -8.390544874

5.693096516 5.208901535 -8.504949457

5.693096516 5.208901535 -8.504949457

5.693096516 5.208901535 -8.504949457

5.693096516 5.208901535 -8.504949457

5.507592395 5.032772979 -8.621179317

5.507592395 5.032772979 -8.621179317

5.507592395 5.032772979 -8.621179317

5.507592395 5.032772979 -8.621179317

5.330066038 4.864419053 -8.736232946

5.330066038 4.864419053 -8.736232946

5.330066038 4.864419053 -8.736232946

5.330066038 4.864419053 -8.736232946

5.160350026 4.703167465 -8.859526159

5.160350026 4.703167465 -8.859526159

5.160350026 4.703167465 -8.859526159

5.160350026 4.703167465 -8.859526159

4.997760145 4.54886204 -8.98198578

4.997760145 4.54886204 -8.98198578

4.997760145 4.54886204 -8.98198578

4.997760145 4.54886204 -8.98198578

4.841844972 4.400909102 -9.106773812

4.841844972 4.400909102 -9.106773812

4.841844972 4.400909102 -9.106773812

4.841844972 4.400909102 -9.106773812

4.692190618 4.258912784 -9.234020305

4.692190618 4.258912784 -9.234020305

4.692190618 4.258912784 -9.234020305

4.692190618 4.258912784 -9.234020305

4.548416899 4.12250959 -9.363858217

4.548416899 4.12250959 -9.363858217

4.548416899 4.12250959 -9.363858217

4.548416899 4.12250959 -9.363858217

4.410173952 3.99136514 -9.49642388

4.410173952 3.99136514 -9.49642388

4.410173952 3.99136514 -9.49642388

4.410173952 3.99136514 -9.49642388

4.277139258 3.86504967 -9.634701216

4.277139258 3.86504967 -9.634701216

4.277139258 3.86504967 -9.634701216

4.277139258 3.86504967 -9.634701216

4.149015014 3.743526445 -9.773128507

4.149015014 3.743526445 -9.773128507

4.149015014 3.743526445 -9.773128507

4.149015014 3.743526445 -9.773128507

4.025398157 3.626406163 -9.911864087

4.025398157 3.626406163 -9.911864087

4.025398157 3.626406163 -9.911864087

4.025398157 3.626406163 -9.911864087

3.906293326 3.513445322 -10.05679735

3.906293326 3.513445322 -10.05679735

3.906293326 3.513445322 -10.05679735

3.906293326 3.513445322 -10.05679735

3.791331499 3.404418101 -10.20521149

3.791331499 3.404418101 -10.20521149

3.791331499 3.404418101 -10.20521149

3.791331499 3.404418101 -10.20521149

3.680292842 3.299114773 -10.35727551

3.680292842 3.299114773 -10.35727551

3.680292842 3.299114773 -10.35727551

3.680292842 3.299114773 -10.35727551

3.572972856 3.197241986 -10.51591728

3.572972856 3.197241986 -10.51591728

3.572972856 3.197241986 -10.51591728

3.572972856 3.197241986 -10.51591728

3.469181053 3.098817901 -10.67580926

3.469181053 3.098817901 -10.67580926

3.469181053 3.098817901 -10.67580926

3.469181053 3.098817901 -10.67580926

3.36873977 3.003571473 -10.83990816

3.36873977 3.003571473 -10.83990816

3.36873977 3.003571473 -10.83990816

3.36873977 3.003571473 -10.83990816

54.05979596 52.7645255 -2.395995834

54.05979596 52.7645255 -2.395995834

54.05979596 52.7645255 -2.395995834

54.05979596 52.7645255 -2.395995834

3.271483102 2.911344574 -11.0084178

3.271483102 2.911344574 -11.0084178

3.271483102 2.911344574 -11.0084178

3.271483102 2.911344574 -11.0084178

3.177158297 2.82198939 -11.17882313

3.177158297 2.82198939 -11.17882313

3.177158297 2.82198939 -11.17882313

3.177158297 2.82198939 -11.17882313

3.085818413 2.735367585 -11.35681951

3.085818413 2.735367585 -11.35681951

3.085818413 2.735367585 -11.35681951

3.085818413 2.735367585 -11.35681951

2.997226658 2.651349549 -11.539905

2.997226658 2.651349549 -11.539905

2.997226658 2.651349549 -11.539905

2.997226658 2.651349549 -11.539905

2.911255413 2.569734798 -11.73104269

2.911255413 2.569734798 -11.73104269

2.911255413 2.569734798 -11.73104269

2.911255413 2.569734798 -11.73104269

2.827784838 2.490569277 -11.92507846

2.827784838 2.490569277 -11.92507846

2.827784838 2.490569277 -11.92507846

2.827784838 2.490569277 -11.92507846

2.746702278 2.413664405 -12.12500811

2.746702278 2.413664405 -12.12500811

2.746702278 2.413664405 -12.12500811

2.746702278 2.413664405 -12.12500811

2.667901731 2.338919231 -12.33113261

2.667901731 2.338919231 -12.33113261

2.667901731 2.338919231 -12.33113261

2.667901731 2.338919231 -12.33113261

2.591283355 2.266238679 -12.54377201

2.591283355 2.266238679 -12.54377201

2.591283355 2.266238679 -12.54377201

2.591283355 2.266238679 -12.54377201

2.516753028 2.195533119 -12.76326702

2.516753028 2.195533119 -12.76326702

2.516753028 2.195533119 -12.76326702

2.516753028 2.195533119 -12.76326702

45.54874858 44.13345608 -3.107203921

45.54874858 44.13345608 -3.107203921

45.54874858 44.13345608 -3.107203921

45.54874858 44.13345608 -3.107203921

2.444146608 2.126651277 -12.99002812

2.444146608 2.126651277 -12.99002812

2.444146608 2.126651277 -12.99002812

2.444146608 2.126651277 -12.99002812

2.373532838 2.059648402 -13.22435618

2.373532838 2.059648402 -13.22435618

2.373532838 2.059648402 -13.22435618

2.373532838 2.059648402 -13.22435618

2.304755048 1.994380471 -13.46670562

2.304755048 1.994380471 -13.46670562

2.304755048 1.994380471 -13.46670562

2.304755048 1.994380471 -13.46670562

2.23773823 1.930776038 -13.71752014

2.23773823 1.930776038 -13.71752014

2.23773823 1.930776038 -13.71752014

2.23773823 1.930776038 -13.71752014

2.172411362 1.868767444 -13.97727534

2.172411362 1.868767444 -13.97727534

2.172411362 1.868767444 -13.97727534

2.172411362 1.868767444 -13.97727534

2.108707143 1.808290565 -14.24648175

2.108707143 1.808290565 -14.24648175

2.108707143 1.808290565 -14.24648175

2.108707143 1.808290565 -14.24648175

2.046561749 1.749227312 -14.52848599

2.046561749 1.749227312 -14.52848599

2.046561749 1.749227312 -14.52848599

2.046561749 1.749227312 -14.52848599

1.985914601 1.691635813 -14.81830026

1.985914601 1.691635813 -14.81830026

1.985914601 1.691635813 -14.81830026

1.985914601 1.691635813 -14.81830026

1.926708164 1.635402525 -15.11934424

1.926708164 1.635402525 -15.11934424

1.926708164 1.635402525 -15.11934424

1.926708164 1.635402525 -15.11934424

1.868827595 1.580475271 -15.42958404

1.868827595 1.580475271 -15.42958404

1.868827595 1.580475271 -15.42958404

1.868827595 1.580475271 -15.42958404

39.32141935 37.89395722 -3.630240598

39.32141935 37.89395722 -3.630240598

39.32141935 37.89395722 -3.630240598

39.32141935 37.89395722 -3.630240598

1.812342549 1.526804393 -15.75519797

1.812342549 1.526804393 -15.75519797

1.812342549 1.526804393 -15.75519797

1.812342549 1.526804393 -15.75519797

1.757141923 1.474342592 -16.0942794

1.757141923 1.474342592 -16.0942794

1.757141923 1.474342592 -16.0942794

1.757141923 1.474342592 -16.0942794

1.70317854 1.422994948 -16.45062956

1.70317854 1.422994948 -16.45062956

1.70317854 1.422994948 -16.45062956

1.70317854 1.422994948 -16.45062956

1.650407427 1.372819187 -16.81937658

1.650407427 1.372819187 -16.81937658

1.650407427 1.372819187 -16.81937658

1.650407427 1.372819187 -16.81937658

1.59878568 1.32372328 -17.20445734

1.59878568 1.32372328 -17.20445734

1.59878568 1.32372328 -17.20445734

1.59878568 1.32372328 -17.20445734

1.548272339 1.275667971 -17.60700369

1.548272339 1.275667971 -17.60700369

1.548272339 1.275667971 -17.60700369

1.548272339 1.275667971 -17.60700369

1.498828273 1.228615712 -18.02825351

1.498828273 1.228615712 -18.02825351

1.498828273 1.228615712 -18.02825351

1.498828273 1.228615712 -18.02825351

1.450416072 1.182530553 -18.46956361

1.450416072 1.182530553 -18.46956361

1.450416072 1.182530553 -18.46956361

1.450416072 1.182530553 -18.46956361

1.402950544 1.137334134 -18.93269943

1.402950544 1.137334134 -18.93269943

1.402950544 1.137334134 -18.93269943

1.402950544 1.137334134 -18.93269943

1.356497215 1.093082091 -19.41877369

1.356497215 1.093082091 -19.41877369

1.356497215 1.093082091 -19.41877369

1.356497215 1.093082091 -19.41877369

34.56926794 33.1737422 -4.03689699

34.56926794 33.1737422 -4.03689699

34.56926794 33.1737422 -4.03689699

34.56926794 33.1737422 -4.03689699

1.310972825 1.049697883 -19.92985186

1.310972825 1.049697883 -19.92985186

1.310972825 1.049697883 -19.92985186

1.310972825 1.049697883 -19.92985186

1.266345893 1.007151005 -20.46793764

1.266345893 1.007151005 -20.46793764

1.266345893 1.007151005 -20.46793764

1.266345893 1.007151005 -20.46793764

1.22258621 0.965412097 -21.03525388

1.22258621 0.965412097 -21.03525388

1.22258621 0.965412097 -21.03525388

1.22258621 0.965412097 -21.03525388

1.179664766 0.924452864 -21.63427351

1.179664766 0.924452864 -21.63427351

1.179664766 0.924452864 -21.63427351

1.179664766 0.924452864 -21.63427351

1.137553676 0.884246001 -22.26775582

1.137553676 0.884246001 -22.26775582

1.137553676 0.884246001 -22.26775582

1.137553676 0.884246001 -22.26775582

1.096226116 0.844726684 -22.94229529

1.096226116 0.844726684 -22.94229529

1.096226116 0.844726684 -22.94229529

1.096226116 0.844726684 -22.94229529

1.05565626 0.805946906 -23.65441887

1.05565626 0.805946906 -23.65441887

1.05565626 0.805946906 -23.65441887

1.05565626 0.805946906 -23.65441887

1.015777657 0.767842751 -24.4083835

1.015777657 0.767842751 -24.4083835

1.015777657 0.767842751 -24.4083835

1.015777657 0.767842751 -24.4083835

0.97665014 0.730390128 -25.21476235

0.97665014 0.730390128 -25.21476235

0.97665014 0.730390128 -25.21476235

0.97665014 0.730390128 -25.21476235

0.938208199 0.693565563 -26.07551673

0.938208199 0.693565563 -26.07551673

0.938208199 0.693565563 -26.07551673

0.938208199 0.693565563 -26.07551673

;

 

Proc sgplot data = Reeses;

series x=ValueRef y=Percent_bias/ lineattrs=(color=blue pattern=solid) ;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Sort the data by the X variable:

 

proc sort data=Reeses; 
by ValueRef;
run;

Proc sgplot data = Reeses;
series x=ValueRef y=Percent_bias/ lineattrs=(color=blue pattern=solid) ;
run;

 

View solution in original post

6 REPLIES 6
Rick_SAS
SAS Super FREQ

Sort the data by the X variable:

 

proc sort data=Reeses; 
by ValueRef;
run;

Proc sgplot data = Reeses;
series x=ValueRef y=Percent_bias/ lineattrs=(color=blue pattern=solid) ;
run;

 

herbman
Obsidian | Level 7
Thank you, this works!
Jay54
Meteorite | Level 14

With SGPLOT Procedure SERIES plot statement, use SMOOTHCONNECT.  Each data point will be connected.  

 

If you have SAS 9.4M3, use SPLINE statement.  Curve will start at first data point and end at the last one, but interior points may not be connected.    

herbman
Obsidian | Level 7
Thank you, where I should put the SMOOTHCONNECT? I added it behind and in front of the "/", both showed syntax error. Is this because I am using SAS 9.3 version?
Jay54
Meteorite | Level 14

Yes, SMOOTHCONNECT was added to SGPLOT in SAS 9.4.   It is available in GTL at SAS 9.3.  

 

If you are not familiar with GTL, add TMPLOUT="filename" to your SGPLOT procedure statement and it will save the generated GTL in the file.  Then, you can add the SMOOTHCONNECT option to the SERIESPLOT statement in the GTL code.  

 

Remember to use the "proc sgrender data=data template=sgplot;" after the proc template step.   "sgplot" is the default template name in the generated proc Template code.  You can change it.

herbman
Obsidian | Level 7
Thank you, I would like to add sort step as Rick suggested for now 🙂

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 6 replies
  • 1332 views
  • 0 likes
  • 3 in conversation