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

Hi all, I have a question I hope you can help me with it.

 

It is possible to reproduce this Graph (showing label and minor tick marks in x axis, using SGPLOT instead?

 

I think the difficulty is insert the minor tickmarcks, 

notice you can do it using GPLOT:

minor=(number=9 color=red height=2 width=1)

 

but I am interested to create this graph in SGPLOT.

 

Thanks,

 

L.

 

 

 

 

 

data dowhlc;
input subjid high low close;
datalines;
1 6511.38 6318.96 6442.49
2 6586.42 6437.10 6544.09
3 6621.82 6481.75 6600.66
4 6621.82 6481.75 6600.66
5 6511.38 6318.96 6442.49
6 6586.42 6437.10 6544.09
7 6621.82 6481.75 6600.66
8 6621.82 6481.75 6600.66
9 6511.38 6318.96 6442.49
10 6586.42 6437.10 6544.09
11 6621.82 6481.75 6600.66
12 6621.82 6481.75 6600.66
13 6511.38 6318.96 6442.49
14 6586.42 6437.10 6544.09
15 6621.82 6481.75 6600.66
16 6621.82 6481.75 6600.66
17 6511.38 6318.96 6442.49
18 6586.42 6437.10 6544.09
19 6621.82 6481.75 6600.66
20 6621.82 6481.75 6600.66
21 6586.42 6437.10 6544.09
22 6621.82 6481.75 6600.66
23 6621.82 6481.75 6600.66
24 6511.38 6318.96 6442.49
25 6586.42 6437.10 6544.09
26 6621.82 6481.75 6600.66
27 6621.82 6481.75 6600.66
28 6511.38 6318.96 6442.49
29 6586.42 6437.10 6544.09
30 6621.82 6481.75 6600.66
run;

data dowhlc2;
set dowhlc;
drop high low close;
dow=high; output;
dow=low; output;
dow=close; output;

title1 'Dow Jones High-Low-Close';
title2 'January, 1997';
footnote height=3 justify=right 'GR08N01 ' ;

symbol interpol=hiloctj
cv=blue
ci=red
width=2;

axis1 order=(10 20 30)
offset=(3,3)
color=blue
label=none
major=(height=3 width=2)
minor=(number=9 color=red height=2 width=1)
width=3;

axis2 color=blue
label=none
major=(height=3)
minor=(number=4 color=red height=1)
offset=(2,2);

proc gplot data=dowhlc2;
plot dow*subjid / haxis=axis1
vaxis=axis2;
run;
quit;

1 ACCEPTED SOLUTION

Accepted Solutions
Luis3
Fluorite | Level 6

I solved my own question 🙂

 

I havr to use minor option and then minorcount=9:

 

xaxis label='Rain' grid values= (10 20 30) minor minorcount=9;

 

Solved 🙂

 

Reproducing GPLOT graph using SGPLOT:

 

data dowhlc;

input subjid high low close;

datalines;

1 6511.38 6318.96 6442.49

2 6586.42 6437.10 6544.09

3 6621.82 6481.75 6600.66

4 6621.82 6481.75 6600.66

5 6511.38 6318.96 6442.49

6 6511.38 6318.96 6442.49

7 6586.42 6437.10 6544.09

8 6621.82 6481.75 6600.66

9 6621.82 6481.75 6600.66

10 6511.38 6318.96 6442.49

11 6511.38 6318.96 6442.49

12 6586.42 6437.10 6544.09

13 6621.82 6481.75 6600.66

14 6621.82 6481.75 6600.66

15 6511.38 6318.96 6442.49

16 6511.38 6318.96 6442.49

17 6586.42 6437.10 6544.09

18 6621.82 6481.75 6600.66

19 6621.82 6481.75 6600.66

20 6511.38 6318.96 6442.49

21 6511.38 6318.96 6442.49

22 6586.42 6437.10 6544.09

23 6621.82 6481.75 6600.66

24 6621.82 6481.75 6600.66

25 6511.38 6318.96 6442.49

26 6511.38 6318.96 6442.49

27 6586.42 6437.10 6544.09

28 6621.82 6481.75 6600.66

29 6621.82 6481.75 6600.66

30 6511.38 6318.96 6442.49

;

 

ods listing close;

ods graphics / reset width=600px height=400px imagefmt=gif;

 

/* The SCATTER statement generates the scatter plot with error bars. */

/* The SERIES statement draws the line to connect the means. */

proc sgplot data=dowhlc noautolegend;

 

scatter x=subjid y=close / yerrorlower=low

yerrorupper=high

markerattrs=(color=blue symbol=CircleFilled);

series x=subjid y=close / lineattrs=(color=blue pattern=2);

xaxis label='Rain' grid values= (10 20 30) minor minorcount=9;

title1 'Plot Means with Standard Error Bars from Calculated Data';

run;

 

 

ods listing;

View solution in original post

3 REPLIES 3
Luis3
Fluorite | Level 6

Hi again,

 

I did part of the job, now need to reproduce the same label and minot tick marks

I used in GPLOT:

If anyone can help me with it, to reproduce the same x axis I did for GPLOT, will

be appreciate,

 

Thanks,

 

data dowhlc;

input subjid high low close;

datalines;

1 6511.38 6318.96 6442.49

2 6586.42 6437.10 6544.09

3 6621.82 6481.75 6600.66

4 6621.82 6481.75 6600.66

5 6511.38 6318.96 6442.49

6 6511.38 6318.96 6442.49

7 6586.42 6437.10 6544.09

8 6621.82 6481.75 6600.66

9 6621.82 6481.75 6600.66

10 6511.38 6318.96 6442.49

11 6511.38 6318.96 6442.49

12 6586.42 6437.10 6544.09

13 6621.82 6481.75 6600.66

14 6621.82 6481.75 6600.66

15 6511.38 6318.96 6442.49

16 6511.38 6318.96 6442.49

17 6586.42 6437.10 6544.09

18 6621.82 6481.75 6600.66

19 6621.82 6481.75 6600.66

20 6511.38 6318.96 6442.49

21 6511.38 6318.96 6442.49

22 6586.42 6437.10 6544.09

23 6621.82 6481.75 6600.66

24 6621.82 6481.75 6600.66

25 6511.38 6318.96 6442.49

26 6511.38 6318.96 6442.49

27 6586.42 6437.10 6544.09

28 6621.82 6481.75 6600.66

29 6621.82 6481.75 6600.66

30 6511.38 6318.96 6442.49

;

 

ods listing close;

ods graphics / reset width=600px height=400px imagefmt=gif;

 

 

proc sgplot data=dowhlc noautolegend;

scatter x=subjid y=close / yerrorlower=low

yerrorupper=high

markerattrs=(color=blue symbol=CircleFilled);

series x=subjid y=close / lineattrs=(color=blue pattern=2);

run;

 

 

ods listing;

Luis3
Fluorite | Level 6

Label 10 20 30 can be done adding this line:

 

xaxis label='Rain' grid values= (10 20 30);

 

Now, I need to add the minor tickmarks , any one can help me with it?

 

thanks.

Luis3
Fluorite | Level 6

I solved my own question 🙂

 

I havr to use minor option and then minorcount=9:

 

xaxis label='Rain' grid values= (10 20 30) minor minorcount=9;

 

Solved 🙂

 

Reproducing GPLOT graph using SGPLOT:

 

data dowhlc;

input subjid high low close;

datalines;

1 6511.38 6318.96 6442.49

2 6586.42 6437.10 6544.09

3 6621.82 6481.75 6600.66

4 6621.82 6481.75 6600.66

5 6511.38 6318.96 6442.49

6 6511.38 6318.96 6442.49

7 6586.42 6437.10 6544.09

8 6621.82 6481.75 6600.66

9 6621.82 6481.75 6600.66

10 6511.38 6318.96 6442.49

11 6511.38 6318.96 6442.49

12 6586.42 6437.10 6544.09

13 6621.82 6481.75 6600.66

14 6621.82 6481.75 6600.66

15 6511.38 6318.96 6442.49

16 6511.38 6318.96 6442.49

17 6586.42 6437.10 6544.09

18 6621.82 6481.75 6600.66

19 6621.82 6481.75 6600.66

20 6511.38 6318.96 6442.49

21 6511.38 6318.96 6442.49

22 6586.42 6437.10 6544.09

23 6621.82 6481.75 6600.66

24 6621.82 6481.75 6600.66

25 6511.38 6318.96 6442.49

26 6511.38 6318.96 6442.49

27 6586.42 6437.10 6544.09

28 6621.82 6481.75 6600.66

29 6621.82 6481.75 6600.66

30 6511.38 6318.96 6442.49

;

 

ods listing close;

ods graphics / reset width=600px height=400px imagefmt=gif;

 

/* The SCATTER statement generates the scatter plot with error bars. */

/* The SERIES statement draws the line to connect the means. */

proc sgplot data=dowhlc noautolegend;

 

scatter x=subjid y=close / yerrorlower=low

yerrorupper=high

markerattrs=(color=blue symbol=CircleFilled);

series x=subjid y=close / lineattrs=(color=blue pattern=2);

xaxis label='Rain' grid values= (10 20 30) minor minorcount=9;

title1 'Plot Means with Standard Error Bars from Calculated Data';

run;

 

 

ods listing;

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 6542 views
  • 1 like
  • 1 in conversation