12-08-2016
teuni
Calcite | Level 5
Member since
09-23-2016
- 11 Posts
- 0 Likes Given
- 0 Solutions
- 0 Likes Received
-
Latest posts by teuni
Subject Views Posted 1792 12-08-2016 10:41 AM 1803 12-08-2016 08:58 AM 1629 11-02-2016 04:36 AM 3606 10-11-2016 05:09 AM 3621 10-10-2016 08:40 AM 3633 10-10-2016 06:41 AM 4820 09-28-2016 09:38 AM 4837 09-27-2016 04:23 AM 4849 09-26-2016 04:40 AM 4865 09-23-2016 11:21 AM -
Activity Feed for teuni
- Posted Re: Add colours to graph // proc template + proc sgrender on Graphics Programming. 12-08-2016 10:41 AM
- Posted Add colours to graph // proc template + proc sgrender on Graphics Programming. 12-08-2016 08:58 AM
- Posted How to calculate the correlation when dealing with repeated measures on Statistical Procedures. 11-02-2016 04:36 AM
- Posted Re: How to calculate time differences (in minutes) between two different character variables? on SAS Procedures. 10-11-2016 05:09 AM
- Posted Re: How to calculate time differences (in minutes) between two different character variables? on SAS Procedures. 10-10-2016 08:40 AM
- Posted How to calculate time differences (in minutes) between two different character variables? on SAS Procedures. 10-10-2016 06:41 AM
- Posted Re: How to create a graph with 2 variables in 1 bar per unit of time on Graphics Programming. 09-28-2016 09:38 AM
- Posted Re: How to create a graph with 2 variables in 1 bar per unit of time on Graphics Programming. 09-27-2016 04:23 AM
- Posted Re: How to create a graph with 2 variables in 1 bar per unit of time on Graphics Programming. 09-26-2016 04:40 AM
- Posted Re: How to create a graph with 2 variables in 1 bar per unit of time on Graphics Programming. 09-23-2016 11:21 AM
- Posted How to create a graph with 2 variables in 1 bar per unit of time on Graphics Programming. 09-23-2016 10:00 AM
12-08-2016
10:41 AM
Hi Rick, Thank you so much for your fast response. I tried this before, but instead of adding group=sex behind the scatterplot statement, I added it behind the regression statement. This did not work out well (obviously!).
... View more
12-08-2016
08:58 AM
Dear all, I would like to add colors to my regression plot. I plotted the regression of proportion of protein consumed in the morning with total amount of protein consumed. What I would like to do is give observations belonging to males and females different colours. Does someone have suggestions where I must add this information in my syntax (see below). Many thanks in advance. proc template; define statgraph propprotbytotprot; begingraph; entrytitle "Proportion of protein ingested during morning by total protein ingested"; layout overlay /xaxisopts=(griddisplay=on)yaxisopts=(griddisplay=on); modelband "cli" / name="mb1" legendlabel="95% Predict" datatransparency=0.5; modelband "clm" / name="mb2" legendlabel="95% Mean"; regressionplot x=prop_sum_prot y=prot_day / cli="cli" clm="clm"; scatterplot x=prop_sum_prot y=prot_day; discretelegend "mb1" "mb2" / border=true across=1 valign=bottom halign=right location=inside; entry halign=left " Nobs=" eval(strip(put(n(prot_day),12.0))) / valign=top; endlayout; endgraph; end; run; proc sgrender data=final.hour template=propprotbytotprot ; label prop_sum_prot="Proportion of protein ingested during morning hours (g)"; label prot_day="Total protein (g)"; run;
... View more
11-02-2016
04:36 AM
Dear all, I would like to assess the relationship between time of day of (protein) intake and overall (protein) intake. Therefore, I want to calculate corelations between the proportion ingested during each hour of the day and the total amount ingested over the entire day. In the end I would like to create a graph such as the one shown in the attachment. In this example, however, time is divided into categories, whereas I want to handle time as a continuous variable. The difficulty is that I am working with repeated measures (2 observations per participant). I do not know exactly how to handle this in my syntax. My data looks as follows. So, for each participant I have 48 records (24 hours for each day). Since I want to correlate the proportion of protein ingested during each hour of the day, I created the variable (proportion_protein), by dividing protein_hour by protein_day and multiplying it by 100. data test1;
input subject:12. day:12. hours:12. protein_day:12. protein_hour:12. proportion_protein:12.;
datalines;
1 1 8 99 0 0
1 1 9 99 11 11
1 1 10 99 0 0
...
...
...
750 2 22 56 0 0
750 2 23 56 0.8 1.5
run; I've thought about the following syntax (adapted from: http://www2.sas.com/proceedings/sugi29/198-29.pdf). However I do not know if I am correct. Do I have to add both proportion_protein and hour into the model, or is this not needed? I have the feeling that if I do not do it, SAS won't know which proportions belong to which hours of the day. ods graphics on; PROC mixed DATA=test method=reml covtest plots(maxpoints=none); Class subject day (ref=first) hour (ref=first); MODEL prot_day = proportion_protein hour proportion_protein*hour / solution ddfm=kr ; Random prot_hour /type=un subject=subject v vcorr; Repeated day / type=un subject=hour(subject) r rcorr; run; ods graphics off; After running this syntax, log says the following: NOTE: Convergence criteria met. NOTE: PROCEDURE MIXED used (Total process time): real time 9.96 seconds cpu time 9.82 seconds I do not exacly know if this is the outcome I needed. Also no graphics are shown. Is it even possible to translate this data into a graph as the one shown in the attachement. Or is this not possible? Can someone maybe help me with this? Many thanks in advance.
... View more
10-11-2016
05:09 AM
Thanks for the advice with respect to the analysis and the way of posting questions. Your suspections were correct. I had to switch the variables!
... View more
10-10-2016
08:40 AM
Thank you RW9 for your advice. However, since I am a very unexperienced SAS-user it is not completely clear to me how to interpret your syntax. Do I solve both problems directly while using this syntax? In addition, it is not clear to me what to fill out at: time="10:15"; comp="14:"; I understand that my question consists of two problems. With respect to the first problem, I've tried the following syntax: data test_3; set test_3; hour2=input(hour,time5.); wakeup2=input(wakeup,best.); run However, it led to the following error (see below) and no outputs were presented. NOTE: Invalid argument to function INPUT at line 1785 column 10. NOTE: Invalid argument to function INPUT at line 1786 column 8. Since this syntax did not work out well, I am also not able to come up with a good solution for the second problem (calculating the difference in time). Can you mabye clarify the syntax in more detail? And, is it necessary that the two variables have the same format before being able to distract them from each other?
... View more
10-10-2016
06:41 AM
Dear all, I would like to calculate time differences between hour-of-wake-up and hours-of-eating (difference in minutes). For each participant I have the hour-of-wake up (e.g. 08:30; character variable $5.) and the hours at which foods are consumed (e.g. 09; character variable $3.). I've recently read a lot about handling time in SAS, however I do not (yet) succeed to calculate the difference in time. I have mainly difficulties with the difference in format statement between the two variables. Can someone please explain me how to calculate the difference? See attachment for example dataset and the output I would like to have. Many thanks in advance
... View more
09-28-2016
09:38 AM
Does comes close to what I would like to have. I prefer using the 'density-statement'. However, I do not think it is 'easy' to overlay a histogram on a box plot, since this type of overlay is incompatable with the SGPLOT procedure.
... View more
09-27-2016
04:23 AM
Is there someone out here who has experience with this? Many thanks in advance!
... View more
09-26-2016
04:40 AM
Thank you for your suggestion Rick. This could have been a good solution if the different food consumption occasions were eaten on different times of the day. However, in my dataset some participants ate breakfast at 11am, whereas others ate lunch at 11am. Consequently, the colours of the different food consumption occassions will mix (and the graph becomes hard to interpretet), see attachment page 1 (please do not pay attention to the axis). I also tried your stacked bar chart suggestion. What I have in mind is that SAS will stack energy on top of protein per hour of the day, and, in order to get an easy-to-interpret graph, cluster this data per food consumption occasion. So, for instance, at 8am, there is 1 stacked (protein and energy) bar called breakfast, and at 11am there are 2 stacked (protein and energy) bars, one called breakfast and one called lunch. I have tried the following syntax, and this will already led me into the right direction (see attachment page 2): proc sgplot data=test_1 nocycleattrs; styleattrs datacolors=(purple blue green yellow orange red pink); vbar hour / response = sum_prot_kcal group=fco groupdisplay=cluster transparency=0.0; vbar hour / response=diff_en group=fco groupdisplay=cluster transparency=0.5; run; What I would like to add to this graph is a line that shows the curve of intake per food consumption occasion (see attachement page 3). Is it possible to add? It will probably give a better overview of the intake distribution over the day. Many thanks
... View more
09-23-2016
11:21 AM
Thank you for your comment and sorry for my unclarity. What I mean is that both protein and energy intake are measured in kcal. Therefore, I think it would be easiest to have one bar for each food consumption occasion which shows both the energy intake per food consumption occasion and the part of the energy intake which is derived from protein. Hopefully the picture will clarify it a bit more (see attachment). The picture shows a bar for each food consumption occasion, and part of the bar is marked. So, for instance, if someone eats 100kcal of energy at breakfast and 35kcal of these 100kcal is derived from protein, then 35% of the bar will be dark-coloured whereas the rest of the bar (which represents energy intake that is not derived from protein but from other nutrients) will be light-coloured. For simplity I made all bars black/white and grey (protein), but what I would like to have, is using a different colour for each food consumption occasion. So, for instance, foods eaten at breakfast are coloured purple (and then the protein part will be dark purple and the rest of the bar will be lighter purple). I hope this will help. Furthermore, I am making use of SAS version 9.4.
... View more
09-23-2016
10:00 AM
Hi! I want to show the distribution of food intake that is consumed over the day, and more specifically... I want to show the distribution of both protein and energy intake (both on the y-axis) that is consumed over the day, per food consumption occasion (fco) (e.g. breakfast, lunch) and per unit of time (both on the x-axis) in a graphical way. I would like to project energy and protein as a vertical bar, and if possible I want both variables to be in the same bar (protein as part of energy per food consumption occasion). Also, I would like to present the food consumption occasion (fco) in different colours, so it is easier to observe differences per fco. I've already tried some gplot syntaxes, but these did not produce the desired outcome. PROC GPLOT data=test_1; PLOT sum_prot*hour=fco PLOT sum_enkcal*hour=fco; RUN; This syntax created two separate plots for protein and energy intake (see attachment for plot energy intake) instead of one in which protein and energy are combined. Also, no bars were created (which is logical when using gplot), and therefore protein and energy intake could not be presented in the same bar. Can someone maybe help me with this? Is it even possible to present protein and energy intake in the same bar, and if, what kind of syntax do I need for this? Many thanks in advance. Best Regards, Teuni
... View more